Reputation: 13
I have been trying to update extensions via the Microsoft Graph Client. I have figured out how to add extensions using:
Dictionary<string, object> addData = new Dictionary<string, object>();
addData.Add("test", "data");
var ext = new OpenTypeExtension();
ext.ExtensionName = "TestData";
ext.AdditionalData = addData;
try
{
graphClient.Users["usernameGoesHere"].Extensions.Request().AddAsync(ext).Wait();
}
But there appears to be a distinct lack of an update async call available under request. I am wondering if I am missing something. I am using Graph Client version Microsoft.Graph 1.4 and Microsoft.Graph.Core 1.5.
Upvotes: 1
Views: 1240
Reputation: 3465
Yes, you are missing one small detail. You have to provide the extension identifier to get the correct request builder for updating an extension.
Dictionary<string, object> addData = new Dictionary<string, object>();
addData.Add("testUpdateKey", "dataUpdateValue");
var extPatchObject = new OpenTypeExtension();
extPatchObject.ExtensionName = "TestData";
extPatchObject.AdditionalData = addData;
try
{
graphClient.Users["usernameGoesHere"].Extensions["TestData"].Request().UpdateAsync(extPatchObject).Wait();
}
Upvotes: 1