Reputation: 603
I am using below Microsoft Graph API api call to get Department name but using User id:
var Peoples = await graphServiceClient.Users[user.Id].People.Request().GetAsync();
foreach (Person People in Peoples)
{
if (People.DisplayName != null && People.DisplayName.Equals(user.DisplayName))
{
Console.Writeline(People.Department)
}
}
Now,i want to get all users in a Department(Where Department Name will be given as input) .
Please help.
Upvotes: 0
Views: 2371
Reputation: 1714
You need to use the filter parameter.
the code will change to the following
var Peoples = await graphServiceClient.Users.Request().Filter("department eq 'departname '").GetAsync();
Upvotes: 3