Search code examples
microsoft-graph-apimicrosoft-graph-calendar

Unable to get OpenTypeExtensionProperty for event using Graph API


For one of our application, I am trying to get Extensions for an event using the following code in C#:

var result = graphServiceClient.User[userid].Calendar.Events[eventid].Extensions.Request().GetAsync().Result;

However, I am getting following exception:

Code: ErrorInvalidRequest Message: The OData request is not supported. ClientRequestId: f7a44c2f-ca79-4f79-9726-2cdc98d87e00

I found the above code in few of the questions posted on stackoverflow.

We need to add and get opentype extensions by any means. Can somebody please help?


Solution

  • First, i used Microsoft Graph explorer to create the event and add opentypeextension to it:

    enter image description here

    Then get the opentypeextensions for the above event using its id:

    enter image description here

    Code will look like this:

    GraphServiceClient graphClient = new GraphServiceClient( authProvider );
    
    var extension = await graphClient.Me.Events["'AAMkAGRlNWYmM5YjIzNTRhMwBGAAAAAAA-AAA='"].Extensions["Com.Contoso.Referral"]
        .Request()
        .GetAsync();