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

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

问题描述

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

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 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 ...

更新:请看一下使用客户端证书流程.博客文章

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图形读取所有用户日历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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