Using Microsoft Graph client sdk how would one go about using search Odata query to lookup if subject or body contains a certain search term.
The $search Odata query parameter is available in the Graph Client api, but i could not find how to use the parameter using the client sdk for c#.
You can access Graph Explorer at: https://developer.microsoft.com/graph/graph-explorer. You can either access demo data without signing in, or you can sign in to a tenant of your own.
Microsoft Graph is the gateway to data and intelligence in Microsoft 365. It provides a unified programmability model that you can use to access the tremendous amount of data in Microsoft 365, Windows, and Enterprise Mobility + Security.
You can add any query parameters by passing in a list of QueryOptions
to the Request
method.
List<QueryOption> options = new List<QueryOption>
{
new QueryOption("$search", "lunch")
};
var messages = await client.Me.Messages.Request(options).GetAsync();
Documentation: https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/dev/docs/overview.md#custom-query-options
Piggybacking off of @JohnStaurt's comments above, this worked for me:
List<QueryOption> options = new List<QueryOption>
{
new QueryOption("$search", "\"displayName:team\" OR \"description:team\"")
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With