I've been trying to create an attachment for my messages by following the documentation provided, but unfortunately, the API seems to be giving me some trouble. I referred to the document at for guidance.
Below is the JavaScript code that I have been using:
obj.createAttachment = function (groupId, threadId, postId) {
var d = $q.defer();
var s = Base64.encode("one drive");
HttpClient.post({
url: "https://graph.microsoft.com/v1.0/groups/" + groupId + "/threads/" + threadId + "/posts/" + postId + "/attachments",
data: {
"@odata.type": "#Microsoft.OutlookServices.FileAttachment",
"Name": "test_one_drive.txt",
"ContentType": "text/plain",
"IsInline": true,
"ContentLocation": "https://wiadvancetechology.sharepoint.com/sites/wiogroup85/Shared%20Documents/test%20one%20drive.txt",
"ContentBytes": s
}
}).then(function (response) {
d.resolve(response);
});
return d.promise;
};
However, I keep getting a "405 Method Not Allowed" response with the error message stating "The OData request is not supported."
Could there be something wrong in the code that I have written?