Forum Discussion
Need Help Updating Planner Task Details Using Microsoft Graph SDK in C#
Hello everyone,
I am facing challenges while trying to update Planner task details using the Microsoft Graph SDK in C#. I have followed the official documentation (https://learn.microsoft.com/en-us/graph/api/plannertaskdetails-update?view=graph-rest-1.0&tabs=csharp#request-headers) , but I'm encountering issues with the provided methods. Here are the details of the problem:
1. Using PatchAsync:
The method PatchAsync mentioned in the documentation is not available in the Graph SDK version 4.44.4 that I'm using. I get a compile-time error when attempting to use this method.
graphClient.Planner.Tasks[task.Id].Details.Request(headers).PatchAsync(requestBody);
2. Using PutAsync:
I tried using the PutAsync method, but I received the following error:
Microsoft.Graph.ServiceException
Message: No HTTP resource was found that matches the request URI 'https://tasks.office.com:444/taskapi/V3.0/tasks({task-Id})/details'.
3. Using CreateAsync and UpdateAsync:
I attempted to use CreateAsync and UpdateAsync methods, but encountered errors related to routing conventions and null values in the request.
Here is how I am constructing the request:
Headers:
var headers = new List<HeaderOption>
{
new HeaderOption("Prefer", "return=representation"),
new HeaderOption("If-Match", TaskETag)
};
Request Body:
var requestBody = new PlannerTaskDetails
{
Checklist = new PlannerChecklistItems
{
AdditionalData = new Dictionary<string, object>
{
{
check.Key , new
{
OdataType = "microsoft.graph.plannerChecklistItem",
Title = check.Value.Title,
IsChecked = check.Value.IsChecked,
}
}
},
},
};
I am seeking guidance on how to properly update task details in Planner using the Microsoft Graph SDK in C#. My goal is to create checklists as Team 1 in Team 2.
Any help or insights on how to resolve this issue would be greatly appreciated. Thank you in advance for your assistance!