问题描述
我正在使用JavaScript发出POST请求以使用xhr创建到Office 365的消息(或者使用法拉第gem发出POST请求-Ruby on Rails).我的流程是将文件编码为base64并创建一个包含所有内容的JSON附件(已编码),然后发布到https://outlook.office.com/api/v1.0/me/sendmail
.
I'm using JavaScript to make a POST request to create a message to Office 365 with xhr (Or using Faraday gem to make POST request - Ruby on Rails).My flow is encode file to base64 and create a JSON contain all attachments(encoded) then POST to https://outlook.office.com/api/v1.0/me/sendmail
.
var endpointUrl = "https://outlook.office.com/api/v1.0/me/sendmail";
var xhr = new XMLHttpRequest();
xhr.open("POST", endpointUrl);
xhr.setRequestHeader("Authorization", "Bearer " + token);
xhr.setRequestHeader("content-type", "application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8");
xhr.send(JSON.stringify(result));
}
此代码可以发送带有大约22.5MB附件的消息,但是如果所有附件的大小都超过23MB,我将收到404错误响应,并且控制台将写入:
This code can send message with about 22,5MB attachments, but if all attachments have more than 23MB, I got 404 error reponse and the cosole write:
将message size restrictions
设置为最大153600
有人可以帮我吗?谢谢!
Alr set message size restrictions
to max 153600
Could someone help me? Thank you !
推荐答案
看起来确实遇到了有效载荷最大大小的限制.当前的限制为37 MB,并通过outlook.office.com强制实施了较低的限制.我们已经打开了一个工作项以增加此限制,以允许我们可以在Office 365中存储的最大附件大小(150 MB),但是您需要等待该附件完成后才能发送尝试大小的邮件发送.
It does look like you are running into a limit on the max size of the payload. The limit currently is 37 MB and a lower limit is being enforced through outlook.office.com. We have opened a work item to increase this limit to allow the max attachment size we can store in Office 365 (150 MB), but you will need to wait for that to be completed before you can send messages of the sizes you are attempting to send.
这篇关于无法使用Office 365 REST API发送大邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!