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

1

5

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?

Turnedon answered 2/7, 2021 at 6:3 Comment(0)
T
10

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.

Turnedon answered 2/7, 2021 at 7:17 Comment(3)
Experienced the same thing this morning, and your suggested fix worked for me. Will have to follow up with Microsoft to hear why this was changed today!Cattegat
Started seeing the same problem. Thanks for posting this, it helped debug much faster.Laroy
I had a similar error trying with the odata.type: "Microsoft.DirectoryServices.OAuth2PermissionGrant", I just change it to "odata.type": "Microsoft.Graph.OAuth2PermissionGrant", and now it works. I think it is due to the migration towards Graph Api for some Azure resources/endpoints And indeed, here explain the odata.type for your casePave

© 2022 - 2024 — McMap. All rights reserved.