Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Outlook API error Invalid OData type specified: Microsoft.OutlookServices.FileAttachment

We have a function set up to send emails via Outlook from our web app and it's been working great, but suddenly this morning my email inbox is flooded with errors from our system saying it couldn't send the email with outlook because of a bad request. The errors all look like this:

{"error":{"code":"BadRequest","message":"Invalid OData type specified: \"Microsoft.OutlookServices.FileAttachment\"","innerError":{"date":"2021-07-02T05:43:00","request-id":"XXX","client-request-id":"XXX"}}}

As I say it was working yesterday, but now it's not. And a lot of these don't have specific attachments outside of the embedded header image, which has not been changed since it was working.

Any suggestions on reasons for the error?

like image 924
user1770717 Avatar asked Jul 02 '21 06:07

user1770717


People also ask

What happened to the outlook REST API?

As announced on November 17, 2020, version 2.0 of the Outlook REST API has been deprecated. Consequently, the beta REST endpoint is also deprecated and will be fully decommissioned in November 2022. Migrate existing apps to use Microsoft Graph.

Is the beta version of the outlook API deprecated?

The beta version of the Outlook REST API is deprecated. As announced on November 17, 2020, version 2.0 of the Outlook REST API has been deprecated. Consequently, the beta REST endpoint is also deprecated and will be fully decommissioned in November 2022.

Is the OData request supported when creating an event in teams?

Re: "The OData request is not supported" when creating an Event in Teams with Graph API @diegoSpace you need to user POST method instead of PUT. and the userId is your email address 。 and the correct request is as below.

Is the mail API supported in all versions of Outlook?

The Mail REST API is supported in all versions of the Outlook REST API. The functionality may differ depending on the specific version. Target user All Mail API requests are performed on behalf of the signed-in user unless specified.


1 Answers

OK so I figured this out. For some reason our attachments were still set as '#Microsoft.OutlookServices.FileAttachment' for the data type. I changed this to 'microsoft.graph.fileAttachment' and it is now working again. I don't know why it decided to force a change over today, but I'll leave this question and answer up in case someone else has the same problem.

like image 69
user1770717 Avatar answered Nov 15 '22 00:11

user1770717