我无法将大附件(超过4Mb)上传到使用Microsoft Graph在共享邮箱中创建的电子邮件。我遵循的步骤是documented here,但没有用。
创建草稿(确定):
=> POST /users/sharedmailbox@account.onmicrosoft.com/mailFolders('drafts')/messages
{ message json }
<= 201
{ message json, id:"XXXX" }
上传小附件(确定):
=> 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.read
,mail.readwrite
,mail.send
,mail.readwrite.shared
,mail.send.shared
。并在共享邮箱中完美创建了带有小附件的电子邮件。
如何通过Microsoft Graph在共享邮箱中创建带有大附件的电子邮件?
答案 0 :(得分:1)
createUploadSession
端点需要以下权限范围之一:Files.ReadWrite
,Files.ReadWrite.All
,Sites.ReadWrite.All
。
由于这涉及到另一个用户,我相信您将需要Files.ReadWrite.All
,因为Files.ReadWrite
仅提供对您自己的云端硬盘的访问权限。
答案 1 :(得分:0)
该问题现在在ms docs网站上列为known issues。