简体   繁体   中英

How to update planner task assignments using Microsoft Graph API

When I tried to patch assignments to a task it only added on to existing ones. For example a task has assignments as {A, B} .

When I did patch assignments {A, C} , the assignments became {A, B, C} while I was expecting it to be updated to {A, C} . When I did patch assignments {} it didn't change anything while I wanted to remove all assignments.

I have not tried it myself but I am certain, if you patch with A's user Id with the null value to task endpit PATCH /planner/tasks/{id} should do the Magic

{ "A's user Guid Id": null, }

Don't forget the etag

Assignments are updated independently. Any assignee not specified in the update will not be altered. So a request to change assignees from A,B to A,C looks like:

{
  "assignments": {
    "User id for B": null,
    "User id for C": { 
      "@odata.type": "microsoft.graph.plannerAssignment",
      "orderHint": " !"
      }
    }
}

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