Reputation: 901
I'm producing a library that will use the Graph API to search through a company's OneDrive folders, per user for "sensitive words and phrases". I'm using the C# Graph SDK, but ultimately the Graph API.
I have a long (and growing) list of search terms. Currently I'm iterating over the search terms, sending a search request and then gathering up the results to store somewhere and ultimately search and report against.
var searchResults = await _client.Users[userId].Drive.Root.Search("foo").Request().GetAsync();
The question is if there is a way to to pass in multiple (many) search terms instead of one at a time and thus multiple (many) API calls.
Upvotes: 0
Views: 921
Reputation: 10614
You might run into problems with what is the logic for the multiple search terms (match all or match any) but the Graph preview in 2015 did introduce the ability to search multiple terms just by adding them to the search URL:
https://graph.microsoft.com/v1.0/me/messages?$search=Ben Henderson
Documentation on when it got added (at least in Azure AD search) can be found here
Fire off await _client.Users[userId].Drive.Root.Search("foo bar").Request().GetAsync();
and watch your Fiddler traffic to make sure the search term is appended.
Upvotes: 1