使用 Microsoft Graph 上传大附件 [英] Uploading a large attachment using Microsoft Graph

查看:111
本文介绍了使用 Microsoft Graph 上传大附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将大 (> 4mb) 附件上传到 Office 365 中的现有邮件.我正在按照以下说明操作:https://docs.microsoft.com/en-us/graph/outlook-large-attachments?tabs=http

I am trying to upload a large (> 4mb) attachment to an existing message in Office 365. I am following these instructions: https://docs.microsoft.com/en-us/graph/outlook-large-attachments?tabs=http

我已经成功创建了上传会话,并获得了一个看起来合法的uploadUrl值,它与文档中的示例大致相符.然后我开始我的 PUT 到这个 url,对于我选择的第一个字节范围.我确定我正确设置了 Content-Type、Content-Length 和 Contact-Range 标头.我的问题是我收到了 http 401(未经授权)作为回应.返回的错误标头是观众声明值对当前资源无效..."并且它反刍我的 url,它看起来完好无损.

I have successfully created the upload session, and obtained a uploadUrl value that looks legitimate, it roughly matches the example in the documentation. Then I start my PUT to this url, for the first byte range that I've selected. I'm sure I'm setting the Content-Type, Content-Length and Contact-Range headers correctly. My problem is that I get http 401 (Unauthorized) in response. The error header returned is "The audience claim value is invalid for current resource..." and it regurgitates my url and it looks intact.

我的理论是我需要为我的应用程序添加另一个 API 权限.我已经有邮件 read.write,这允许我创建一个 <4mb 附件.如果我需要另一项许可,是哪一项?还是我有其他问题?

My theory is that I need to add another API permission to my application. I already have mail read.write, and that allows me to create a < 4mb attachment. If I need another permission, which one? Or do I have some other problem?

推荐答案

根据此 文档页面关于可恢复上传,您需要Files.ReadWriteFiles.ReadWrite.AllSites.ReadWrite.All 委派工作帐户的权限.如果您使用的是应用程序令牌,则需要 Sites.ReadWrite.All 权限.

According to this documentation page on Resumable Uploads, you'll need any of Files.ReadWrite, Files.ReadWrite.All or Sites.ReadWrite.All permissions for a Delegated Work account. If you're using an Application token, then you need Sites.ReadWrite.All permission.

这篇关于使用 Microsoft Graph 上传大附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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