I'm using the Microsoft Graph .Net SDK to interact with Planner.
I've just created a PlannerTask
, and I'd like to set the Description property.
My approach for this is covered in: How can I create a planner task with a description?
Here's the code which takes the returned PlannerTaskDetails
object, modifies the Description, and then updates it:
var taskDetails = taskDetailsResult.Result; // Get Previous Task Details
taskDetails.Description = description;
task.Details = await graphServiceClient
.Planner
.Tasks[task.Id]
.Details
.Request()
.Header("If-Match", taskDetails.GetEtag())
.UpdateAsync(taskDetails);
UpdateAsync returns, but it returns a null. There's no exception, the null obviously contains no further information, and the Description is not changed.
I used Fiddler to monitor the HTTP traffic going back and forth. I can see that a PATCH
request is being sent to the Graph API, and it has the If-Match
header set.
Oddly, the JSON object in the request body has the description property listed twice! The first time with my value, and the second time with a null.
I assume the deserializer is taking the last value it sees for a property, and so that's why it doesn't update.
What am I doing wrong?