【问题标题】:How to create a email with a large attachment in a shared mailbox如何在共享邮箱中创建带有大附件的电子邮件
【发布时间】:2019-12-24 12:02:27
【问题描述】:

我无法将大型(超过 4Mb)附件上传到使用 Microsoft Graph 在共享邮箱中创建的电子邮件。我遵循的步骤是documented here,但它们不起作用。

创建草稿(确定):

=> POST /users/sharedmailbox@account.onmicrosoft.com/mailFolders('drafts')/messages

{ message json }

<= 201

{ message json, id:"XXXX" }

上传小附件(OK):

=> POST /users/sharedmailbox@account.onmicrosoft.com/messages/XXXX/attachments

{"contentBytes": "BASE64..." }

<= 201 

{ attachment json }

上传大型附件(失败)

=> POST
/users/sharedmailbox@account.onmicrosoft.com/messages/XXXX/attachments/createUploadSession

{ AttachmentItem: { attachment json } }

<= 201 

{ upload session json, uploadUrl: "https://outlook.office.com/api/beta/Users('guid@otherguid')/Messages('XXXX')?authtoken=SOME-JWT" }
=> PUT uploadUrl-from-above

attachment-body

<= 403 

{ 
  "error": {
    "code":"ErrorAccessDenied",
    "message":"Access is denied. Check credentials and try again."
  }
}

我已请求以下权限:user.readmail.readwritemail.sendmail.readwrite.sharedmail.send.shared。带有小附件的电子邮件完美地创建在共享邮箱中。

如何通过 Microsoft Graph 在共享邮箱中创建带有大附件的电子邮件?

【问题讨论】:

    标签: microsoft-graph-api onedrive microsoft-graph-mail


    【解决方案1】:

    createUploadSession 端点需要以下权限范围之一:Files.ReadWriteFiles.ReadWrite.AllSites.ReadWrite.All

    由于这涉及到其他用户,我相信您将需要 Files.ReadWrite.All,因为 Files.ReadWrite 仅提供对您自己的云端硬盘的访问权限。

    【讨论】:

    • 好主意,谢谢,但没有帮助。使用具有这些额外权限的访问令牌会产生相同的错误。
    【解决方案2】:

    该问题现在在 ms 文档站点上列为 known issues

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-15
      相关资源
      最近更新 更多