Our asp.net based users also have access to sharepoint. What we want is they should get authenticated to sharepoint and then get redirected to our website. In this way our website will get users access token, and using that token our website can do operations on sharepoint (search/download), which is specific to that user.
We are right now using CSOM and KeywordQuery on sharepoint from our website.
KeywordQuery keywordQuery = new KeywordQuery(ctx); keywordQuery.QueryText = "path:https://sharepointurl.com/sites/site1/ " + a + " -ContentClass=urn:content-class:SPSSearchQuery"; keywordQuery.ProcessBestBets = true; keywordQuery.EnablePhonetic = true; keywordQuery.EnableNicknames = false; keywordQuery.EnableStemming = true; keywordQuery.TrimDuplicates = true; SearchExecutor searchExecutor = new SearchExecutor(ctx);
This query is searching whole sharepoint. But it should not search sites/folders on which user does not have access.