简体   繁体   English

Microsoft Graph API列表位置

[英]Microsoft Graph API List Locations

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 https://graph.microsoft.io/zh-CN/docs/api-reference/v1.0/resources/location

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). 您可以获得现有日历事件的列表,并且仅选择locations属性(链接到的位置)。 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. 对我来说,以下代码片段返回了247个唯一位置。

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

With the Graph JavaScript SDK this looks like: 使用Graph JavaScript SDK,它看起来像:

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 . 关于列出会议室,还有一些现有的思路。

So We decided not to use the graph API at all. 因此,我们决定完全不使用图API。 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. 任何一家涉及SME规模的组织的核心问题都是预订房间。 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. 我们选择使用Office 365 SDK,ADAL和Outlook,并采用复杂的方法来解决涉及检查日历或检查收件箱是否已预订的问题。 Then we opted to figure out whether the room was busy or not using the preview availability Api. 然后,我们选择使用预览可用性Api来确定会议室是否忙碌。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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