1

As stated above I am currently unable to fetch the room capacity per room in Microsoft Exchange.

Below is part of my code that displays the room id, displayName, start time and end time. But no matter where I search the room capacity property is nowhere to see.

    const data = calendarEvent.map((event: microsoftgraph.Event) => {
        return {
            id: event.id,
            title: event.location.displayName,
            capacity: event.location.roomCapacity, //(I know this isn't a real graph property) But in theory this is what I am trying to, but I am unable to find a property that has the name capacity. 
            allDay: false,
            start: new Date(event.start.dateTime + "z"), 
            end: new Date(event.end.dateTime + "z"),
        }
    });

I've tried looking in ms graph explorer, /v1.0/me/events still no property called capacity. https://developer.microsoft.com/en-us/graph/graph-explorer

  • Location doesn't have any property with information about capacity. Why do you suppose that capacity property should exist? https://learn.microsoft.com/en-us/graph/api/resources/location?view=graph-rest-1.0#properties – user2250152 Nov 14 '22 at 12:42
  • The example above was just to give some context and to show what I am trying to do. I know that the location property does not have a capacity property. What I am trying to find out is how to fetch the capacity information. I've tried several properties but none of them seems to have the property, capacity. – liondepierre Nov 14 '22 at 12:47

1 Answers1

0

You need to use displayName property of the location and make another call to this endpoint

https://graph.microsoft.com/v1.0/places/microsoft.graph.room
https://graph.microsoft.com/v1.0/places/microsoft.graph.room?$filter=displayName eq '{name}'

Which returns the collection of rooms.

Room resource type has property capacity which specifies the capacity of the room.

Resources:

List places

user2250152
  • 14,658
  • 4
  • 33
  • 57
  • I appreciate your answer, it helped me in the right direction on where to find the capacity of my MS Exchange rooms. I am able to fetch the room data by using pnp/graph graphfi factory interface and use graph.me or graph.users to get the properties. I am however facing a problem on fetching graph.places as it does not show up as a property of the graph object. Could you clarify what you mean by using the `displayName`property of the location and make another call to the endpoint. – liondepierre Nov 15 '22 at 11:06
  • @liondepierre what library do you use for calling Graph API? – user2250152 Nov 15 '22 at 11:20
  • I use PnPJs and use the @pnp/graph graphfi factory interface in SPFx. I don't know if it is any help but for context I access my event properties with the following method `const getSpecificCalendar = async () => { await graph.me.events().then((e) => setCalendarEvent(e)); } ` – liondepierre Nov 15 '22 at 11:44
  • @liondepierre Cannot find any method in @pnp/graph to get room data. – user2250152 Nov 15 '22 at 12:02
  • Yeah, I figured as much. Seems like I need to find an alternative for getting `event data` and `places/microsoft.graph.room data`. – liondepierre Nov 15 '22 at 12:03