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.
Adding the ODataType has worked for me:
var openExtension = new OpenTypeExtension
{
ODataType = "microsoft.graph.openTypeExtension",
ExtensionName = "com.TechApp.Extensions",
AdditionalData = dict
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.