alek kowalczyk
alek kowalczyk

Reputation: 4936

MS Graph API: Requests must contain extension changes exclusively

I want to add a data extension to an existing resource using the MS Graph API.

For that I make a POST request to following endpoint:

https://graph.microsoft.com/v1.0/users/[USER_ID]/events/[EVENT_ID]/extensions

with following request body:

{
        "@odata.type": "Microsoft.Graph.OpenTypeExtension",
        "extensionName": "[MY_EXTENSION_NAME]",
        "my_field": "my_value"
}

but from time to time, the only response I get is:

{
  "error": {
    "code": "BadRequest",
    "message": "Requests must contain extension changes exclusively.",
    "innerError": {
        "request-id": "c10c8e95-dd89-455b-9a83-3d2441918618",
        "date": "2017-02-21T21:10:55"
    }
  }
}

What does this message means?

Found out, that following request works:

{
        "@odata.type": "Microsoft.Graph.OpenTypeExtension",
        "extensionName": "[MY_EXTENSION_NAME]"
}

so without any value for this extension point, which makes it kinda useless. The weirdest part is, that it worked with the value for several weeks.

Upvotes: 0

Views: 528

Answers (1)

user1649304
user1649304

Reputation:

I've been getting this issue, but I think what is happening is that I'm using a patch message to update the extension. Because this is intermittent, I suspect that in some random cases the empty extensions are being added and then the API is allowing an update of a non-existent ID. It sometimes gets caused when replying to a message, and other times it doesn't - in both cases this is outlook365 sender and recipient.

What probably needs to be done in my case is create the post message if the extension isn't found on my draft message, otherwise use the patch to update it.

I do find it incredibly peculiar that it works in some cases but not others. It strikes me that it should either work every time or not at all - not have some weird random possiblity of it happening.

Update: I've just tried doing it in graph explorer and I don't seem to be able to add the extension to a draft at all now.

Upvotes: 1

Related Questions