N. Koller
N. Koller

Reputation: 23

IUserPeopleCollectionRequest Request().Search() Option missing?

I am trying to search for a peroson in my Contacts with the Graph API. I am on Microsoft.Graph (3.19.0). The Filter Option is there, but it doesn't support fuzzy search. It should be there as the graph explorer suggestst:

enter image description here

When I use this, I get the Message "IUserPeopleCollectionRequest has no definition for "Search""

Is it not added yet? Did I forget to update something?

I can bypass this by simply doing a HTTP Request, but I would like to stick to the GraphClient, since HTTP requests are not as elegant when executet asynchronous (correct me if I'm wrong).

Some information would be appreciated or an asynchronous alternative.

Upvotes: 0

Views: 218

Answers (1)

Shiva Keshav Varma
Shiva Keshav Varma

Reputation: 3585

You can try using the $search query parameter by using QueryOptions class.

List<QueryOption> options = new List<QueryOption>
{
     new QueryOption("$search", "N")
};
await graphClient.Me.People
                    .Request(options)
                    .GetAsync();

This is exactly same as graph call

https://graph.microsoft.com/v1.0/me/people?$search="n"

You can also use other query parameters like filter, top etc., with the help of this class.

Upvotes: 1

Related Questions