无法在 Microsoft Graph API 中获取具有开放扩展的事件 [英] Can't get events with open extension in Microsoft Graph API

查看:15
本文介绍了无法在 Microsoft Graph API 中获取具有开放扩展的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过 Graph API 中的共享邮箱创建了一个事件.

I created an event through a shared mailbox in Graph API.

https://graph.microsoft.com/v1.0/users/{shared-user-id}/calendars/{shared-calendar-id}/events

{
  "subject": "New Event Test",
  "body": {
    "contentType": "HTML",
    "content": "Mail FLow Test"
  },
  "start": {
      "dateTime": "2021-01-29T12:00:00",
      "timeZone": "Eastern Standard Time"
  },
  "end": {
      "dateTime": "2021-01-30T14:00:00",
      "timeZone": "Eastern Standard Time"
  },
  "attendees": [
    {
      "emailAddress": {
            "address":"calendar@contoso.com",
            "name": "Calendar Organizer"
        },
        "type": "required"
    }
  ]
}

这成功创建了一个事件,之后,我使用开放扩展使用扩展数据修补了这个事件.

This creates an event successfully, and after that, I patched this event with extended data using open extension.

https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/events/{just-created-event-id}

{
  "extensions": [
        {
          "@odata.type": "microsoft.graph.openTypeExtension",
          "extensionName": "Com.Contoso.Events",
          "courseId": 22,
          "materialId": 75,
          "courseType": "video"
        }
      ]
}

这似乎不起作用.此响应访问被拒绝.

This seems not to work. This responses Access is denied.

https://graph.microsoft.com/v1.0/users/{shared-user-id}/calendars/{shared-calendar-id}/events?$expand=extensions($filter=id eq 'Microsoft.OutlookServices.OpenTypeExtension.Com.Contoso.Events')

它以错误消息访问被拒绝"响应 ErrorAccessDenided.检查凭据并重试".但是如果我在不扩展扩展的情况下尝试这个,那么它就可以了.

It responses ErrorAccessDenided with error message "Access is denied. Check credentials and try again". But if I try this without expanding extensions, then it works.

我什至无法创建一个事件,因为它响应了相同的错误和消息访问被拒绝.检查凭据并重试",因此我在 Azure AD 中添加了一个 API 权限 MailboxSettings.ReadWrite,使工作成为通过​​共享邮箱创建事件.

I couldn't even to create an event because it responded with the same error and message "Access is denied. Check credentials and try again", so I added an API permission MailboxSettings.ReadWrite in my Azure AD that made work an event creation through the shared mailbox.

我可以创建或获取事件但不能添加或扩展扩展的原因是什么?

What is the reason why I can create or get events but not add or expand extensions?

推荐答案

将我的评论移至此处,以便将此问题视为已回答.

Move my comment here so that this issue is treated as answered.

您使用的方法不正确.请参考 这个示例来创建开放的扩展.

The method you are using is incorrect. Please refer to this sample to create the open extension.

但根据我的测试,我们不能使用管理员(或委托用户或共享邮箱成员)为共享邮箱创建扩展名(即使我添加了 Calendars.Readwrite.Shared 许可).如您所见,它会给出 403 错误.

But based on my test, we cannot use an admin (or a delegated user or a shared mailbox member) to create the extension for the shared mailbox (Even if I have added Calendars.Readwrite.Shared permission). It will give 403 error as you have encountered.

当我使用共享邮箱用户登录时,它可以为自己创建开放分机.

When I sign in with the shared mailbox user, it can create the open extension for itself.

所以结论是:当我们使用委托权限(用户令牌)时,只能为当前登录的用户自己创建一个开放的扩展.

So the conclusion is: when we use delegated permissions (user token), we can only create an open extension for the currently logged in user himself.

这篇关于无法在 Microsoft Graph API 中获取具有开放扩展的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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