azure active directory – Graph API to get all the rooms
If you need only emailAddress
of a room and object id
you can reduce the amount of data in the response by using Select
.
var roomUrl = graphClient.Places.AppendSegmentToRequestUrl("microsoft.graph.room");
var response= await new GraphServicePlacesCollectionRequest(roomUrl, graphClient, null).Select("emailAddress").GetAsync();
foreach (var room in response.CurrentPage)
{
var emailAddress = (string)room.AdditionalData["emailAddress"];
var objectId = await graphClient.Users[emailAddress].Request().Select("id").GetAsync();
users.Add(objectId);
}
}
I don’t have 25k rooms in my tenant, so you need to measure how much faster is the code with Select
.
Read more here: Source link