使用 Microsoft graph 读取所有用户日历 [英] Using Microsoft graph to read all users calendars

查看:30
本文介绍了使用 Microsoft graph 读取所有用户日历的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我的应用程序提供了以下范围:

I gave my application the following scopes:

SCOPES = [ "Calendars.Read", "User.Read.All" ]

我得到了一个访问令牌.有了这个令牌,我可以得到用户,我得到了两个用户,这是正确的.

I got an access token. With this token I am able to get the users and I get two users back which is correct.

然后当我询问我自己(管理员)的日历时:

When I then ask for the calendar of myself (admin):

https://graph.microsoft.com/v1.0/users/stijn@temponia.onmicrosoft.com/calendarview?startDateTime=#{start_date.to_s}&endDateTime=#{end_date.to_s}

这也很有效.但是,当我为其他用户执行此操作时:

This also works perfectly. However when I do this for the other user:

https://graph.microsoft.com/v1.0/users/frank@temponia.onmicrosoft.com/calendarview?startDateTime=#{start_date.to_s}&endDateTime=#{end_date.to_s}

我收到此错误消息:

Access is denied. Check credentials and try again.

根据文档:https://graph.microsoft.io/en-us/docs/authorization/permission_scopes

Calendars.Read:读取所有邮箱中的日历:允许应用在没有登录用户的情况下读取所有日历的事件.

我与访问令牌一起返回的范围是:calendars.read user.read.all"所以它被接受了.

The scope I got back together with the access token was this: "calendars.read user.read.all" so it got accepted.

我在这里错过了什么?

推荐答案

我们正在努力支持您请求的方案(访问其他用户的日历),但该功能尚未发布.敬请期待...

We are working to support the scenario you are requesting (Accessing other users' calendars) but the feature hasn't shipped yet. Stay tuned ...

更新:请查看使用客户端凭据流.博文 https://blogs.msdn.microsoft.com/exchangedev/2015/01/21/building-daemon-or-service-apps-with-office-365-mail-calendar-and-contacts-apis-oauth2-client-credential-flow/ 解释了如何为 Outlook API 端点执行此操作.但您也应该能够按照 Microsoft Graph 的说明进行操作.

UPDATE: Please take a look at using client credential flow. The blog post https://blogs.msdn.microsoft.com/exchangedev/2015/01/21/building-daemon-or-service-apps-with-office-365-mail-calendar-and-contacts-apis-oauth2-client-credential-flow/ explains how to do this for Outlook API endpoint. But you should be able to follow the instructions for Microsoft Graph as well.

该应用需要管理员同意,然后才能访问组织中任何用户的日历,只要他们的邮箱在 Office 365 中.

The app will require an admin to consent, and then can access calendar of any user in the organization, as long as their mailbox is in Office 365.

这篇关于使用 Microsoft graph 读取所有用户日历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆