简体   繁体   English

Microsoft Graph API:如何使用 API 访问来宾日历事件?

[英]Microsoft Graph API: How to access guest calendar events using API?

I am working on the integration of the outlook calendar with our app.我正在努力将 outlook 日历与我们的应用程序集成。 I am trying to get the calendar events of the guest user.我正在尝试获取来宾用户的日历事件。 So far I have done the following steps.到目前为止,我已经完成了以下步骤。

Registered an app in the Azure Active Directory admin centre and added the following API permissions.在 Azure Active Directory 管理中心注册了一个应用程序并添加了以下 API 权限。

API permissions API 权限

Then I used the following API call to get the access token.然后我使用以下 API 调用来获取访问令牌。

https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token

I used this token to get the user list which is working fine.我使用此令牌来获取工作正常的用户列表。

https://graph.microsoft.com/v1.0/users

Then I am using user_id from this result to call the following APIs然后我使用此结果中的 user_id 来调用以下 API

https://graph.microsoft.com/v1.0/users/{user_id}/calendars
https://graph.microsoft.com/v1.0/users/{user_id}/calendars/events
https://graph.microsoft.com/v1.0/users/{user_id}/events

I am getting a successful result for Member users but getting the following error for guest users我为会员用户获得了成功的结果,但为来宾用户获得了以下错误

>AuthOMMissingRequiredPermissions
>The AadGuestPft token doesn't contain the permissions required by the target API.

Any Idea what am I missing?知道我错过了什么吗?

To get guest users(external) you can use https://graph.microsoft.com/v1.0/users?$filter=userType eq 'Guest' Graph API endpoint.要获得来宾用户(外部),您可以使用https://graph.microsoft.com/v1.0/users?$filter=userType eq 'Guest' Graph API 端点。 This will give you all external users details in response.这将为您提供所有外部用户的详细信息作为回应。 Event API will only work for the user within tenant, for external users who does not have license it will not work.事件 API 仅适用于租户内的用户,对于没有许可证的外部用户将不起作用。

Hope this helps.希望这可以帮助。

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

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