Reputation: 603
I am using below code to find users in Department :
string searhString="IT Admin Onsite";
var departmentPeoples = await graphServiceClient.Users.Request().Filter($"department eq '{searchString}'").Select(u => new {
u.DisplayName,
u.MobilePhone,
u.BusinessPhones,
u.UserPrincipalName
}).GetAsync();
But, i want to search all Department which contains ,hence my searchString will be
string searhString="Admin";
I have tries startswith ,but that will work only when my searchString is "IT" in the given example code. How to achieve this Task?
Please Help.
Upvotes: 3
Views: 8849
Reputation: 49
I believe @Allen Wu's answer to this may be outdated. According to this documentation contains appears to be generally supported, but it varies from endpoint to endpoint. https://learn.microsoft.com/en-us/graph/query-parameters#filter-parameter
Upvotes: 3
Reputation: 16458
I'm afraid that contains
is not supported on any Microsoft Graph resources.
See details here.
Note: The following $filter operators are not supported for Azure AD resources: ne, gt, ge, lt, le, and not. The contains string operator is currently not supported on any Microsoft Graph resources.
Currently you could get all the results and filter with the Department in your C# code.
Upvotes: 7