简体   繁体   中英

MS Graph API ... create Planner task including details/description using one single HTTP request?

I am using the Microsoft Graph API to create Planner tasks, and I am wondering if there is a way to create a task including task details/description using a single HTTP request.

This old question from 2018 is asking about the same thing. The outcome in 2018 was that several separate requests were necessary... first creating the task, then getting and updating its details object, which is a somewhat cumbersome process.

The original answerer has recently updated their answer to say that this behavior has changed and "you can set task details fields in the same request as creating the task". However, I'm confused as to whether this applies to the REST API itself, or to the Microsoft SDKs (which I am not currently using, as I don't need most of their functionality).

When I make a POST request to the /planner/tasks endpoint, and supply the details object in the body like such...

{
  "planId": "(... plan ID ...)",
  "bucketId": "(... bucket ID ...)",
  "title": "Title for new task",
  "details": {
    "description": "Some description for new task"
  },
  "assignments": {
       (... assignment data ...)
  }
}

... the task is created, but I don't see any description/notes. This applies both to the "v1.0" and "beta" APIs. (I tried the newer "notes" property on the beta API as well, with the same result.)

Based on the MS docs I could not find a conclusive answer either.

Should a request such as the one I listed work right now? If yes, in which API version? If no, what am I missing?

Thanks!

That request should work, but there is an issue with the returned response to the create operation not including the task details. If you read the task details after the creation (or reading task expanding the details), the description should be there.

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