0

Hi I am having trouble finding any way to list locations so I can create an event and add a location to it. There is a list of known locations that should be available shouldn't there be?

https://graph.microsoft.io/en-us/docs/api-reference/v1.0/resources/location

George Host
  • 980
  • 1
  • 12
  • 26

2 Answers2

0

I'm not sure that listing known locations is available, so we'll need to be creative on this one.

You could get a list of existing calendar events and only select the locations property (what you linked to). If you then filter these client side to remove duplicates, you can get a decent list of known locations. The down side is that if a room is now available but has never been used, it won't appear in this list. Also, this is only for one user so another idea is querying a different (or multiple) calendars. For me, the following snippet returns around 247 unique locations.

https://graph.microsoft.com/v1.0/me/events?$select=location&$top=500

With the Graph JavaScript SDK this looks like:

client
    .api('/me/events')
    .select('location')
    .top(500)
    .get((err, res) => {
        var locations = res.value
            .map((x) => x.location.displayName) //only get the displayName
            .filter((v, i, a) => a.indexOf(v) === i) // remove duplicates

    });

There's also some existing threads about listing conference rooms.

Community
  • 1
  • 1
David
  • 2,412
  • 1
  • 14
  • 22
0

So We decided not to use the graph API at all. It is not ready I actually cannot believe this is an oversight on Microsoft's part. Any organization's core problem when it gets to SME size is booking a room. We opted to use the Office 365 SDK,ADAL and Outlook and use a convoluted way to solve the problem that involves either checking the calendar or checking your inbox for the room being booked or not. Then we opted to figure out whether the room was busy or not using the preview availability Api.

George Host
  • 980
  • 1
  • 12
  • 26
  • Sorry to hear that you had this trouble, the information exposed in the Outlook endpoint is the same the is exposed in the Microsoft Graph, can you please share more details on how you solved the issue so we can follow up on our side? – Yina - MSFT Oct 20 '16 at 17:30
  • We couldn't get that solution to work very well could we contact you via your microsoft email ? to describe the problem ? – George Host Oct 22 '16 at 18:40