简体   繁体   中英

AAD Object ID of a rooms on running https://graph.microsoft.com/v1.0/places/microsoft.graph.room

I have the following code to get rooms from graph:

            var roomUrl = graphClient.Places.AppendSegmentToRequestUrl("microsoft.graph.room");
            var response= await new GraphServicePlacesCollectionRequest(roomUrl, graphClient, null).GetAsync();
            if (response.CurrentPage.Count > 0)
            {
                foreach (var room in response.CurrentPage)
                {  
                    Console.WriteLine(room.Id);
                }
            }             

room.Id represents RoomId which is different from AAD object Id of the room.

Is there a way to get object Id of the room instead of room Id in the response?

You will need to call another endpoint.

Take an emailAddress of the room and call Users endpoint. Users endpoint doesn't return only users but also rooms.

var roomMail = room.EmailAddress;
var roomUser = await graphClient.Users[roomMail].Request().GetAsync();
// read AAD object id
var aadObjectId = roomUser.Id;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM