简体   繁体   中英

Planner Tasks Graph API: Update Task Issue

We have developed an application which calls Update Task Planner Graph API to update task in Planner App. The API was working fine until some recent change in the MS docs and now it keeps throwing below error.

A type named 'microsoft.taskServices.plannerCheckListItemCollection' could not be resolved by the model. When a model is available, each type name must resolve to a valid type.

Below is the code for creating and updating the Task using Graph API.

var newTask = new PlannerTask
{
    PlanId = "planID",
    BucketId = "bucketID",
    Title = "title"
};

Logger.LogInfo(userLogs + "Task object created, calling Graph API");
var taskResponse = await graphClient.Planner.Tasks.Request().AddAsync(newTask);

PlannerTaskDetails taskDetails = new PlannerTaskDetails
{
    Checklist = new PlannerChecklistItems { AdditionalData = checkListItems }
};

Logger.LogInfo(userLogs + "Getting Details of created Task");

PlannerTaskDetails getTaskDetails = await graphClient.Planner.Tasks[taskResponse.Id].Details.Request().GetAsync();
var eTagId = getTaskDetails.GetEtag();

Logger.LogInfo(userLogs + "Updating Task");
await graphClient.Planner.Tasks[taskResponse.Id].Details.Request()
    .Header("Prefer", "return=representation")
    .Header("If-Match", eTagId)
    .UpdateAsync(taskDetails);

Code snippet for CheckListItems :

Dictionary<string, Object> checkListItems = new Dictionary<string, object>();
checkListItems.Add(key, new PlannerChecklistItem
{
    Title = "title",
    IsChecked = True
});

Also proper App Permissions in Azure are already given as this was working fine till last month.

This was a bug, and the issue should be resolved now.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM