1

I'm using Microsoft.Graph to create an Office365 calendar event. It works fine and I can create an event but I need to add a couple of extra string properties to an event, so I've created an extension for that. It compiles fine. But when I try to run it and create an event with added extension, it throws an error:

Code: RequestBodyRead Message: The property 'extensionName' does not exist on type 'Microsoft.OutlookServices.Extension'. Make sure to only use property names that are defined by the type or mark the type as open type.

//Extension
var evExtCollPage = new EventExtensionsCollectionPage();
var dict = new Dictionary<string,object>();
dict.Add("eSmtTickeId", "123");
            dict.Add("siteId", "456");
var openExtension = new OpenTypeExtension
{
    ExtensionName = "com.TechApp.Extensions",
    AdditionalData = dict
};
evExtCollPage.Add(openExtension);


Event createdEvent = await graphClient.Me.Events.Request().AddAsync(new Event
{
    Subject = "Service appointment",
    Location = location,
    Attendees = attendees,
    Body = body,
    Start = startTime,
    End = endTime,
    Extensions = evExtCollPage
});

What is wrong with my extension? I've struggled with this for 3 days now.

MrCalvin
  • 1,675
  • 1
  • 19
  • 27
Sam Var
  • 11
  • 4

1 Answers1

2

Adding the ODataType has worked for me:

var openExtension = new OpenTypeExtension
{
    ODataType = "microsoft.graph.openTypeExtension",
    ExtensionName = "com.TechApp.Extensions",
    AdditionalData = dict
};
perfect_element
  • 663
  • 9
  • 15