问题
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));
}
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:
XMLHttpRequest cannot load https://outlook.office.com/api/v1.0/me/sendmail. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 404.
Alr set message size restrictions
to max 153600
Could someone help me? Thank you !
回答1:
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.
来源:https://stackoverflow.com/questions/34595303/can-not-send-large-message-with-office-365-rest-api