While MSDN has some good documentation on how to create and get open extensions, I couldn't find anything for the same purpose using the Microsoft Graph SDK.
So I have been trying the following.
Updating an event with a new open type extension:
await new EventRequest(fullEventUrl graphClient, null)
.UpdateAsync(new Event
{
// Change the subject so that I can tell the event is updated by looking at my calendar
Subject = "Updated Event " + Guid.NewGuid(),
// Add a new open type extension.
Extensions = new EventExtensionsCollectionPage
{
// I also don't know how to add my own properties to the extension.
// Tried using my own derived class here but didn't work either.
new OpenTypeExtension {ExtensionName = "com.consoto.customExtensionName"}
}
});
This call gives me a successful response with the event details, however, there's no extensions in the returned event JSON. Seems to be an indication that the event is created ignoring the extension I put in there.
Getting the event with expand extension filter:
await new EventRequest(fullEventUrl, graphClient, null).Expand(
"Extensions($filter=id eq 'com.consoto.customExtensionName')").GetAsync();
This gets the event successfully, with an empty extension collection in the JSON.
Am I missing something here or the SDK is still not updated to support creating open extension after 4 years?