Microsoft Graph does not retrieve the Group's Plan Id

随声附和 提交于 2020-01-13 05:58:30

问题


After creating a Group using POST /v1.0/groups with the body:

{
    "description": "hello",
    "displayName": "group_for_restore",
    "groupTypes": [
        "Unified"
    ],
    "mailEnabled": true,
    "mailNickname": "group_for_restore",
    "securityEnabled": false,
    "visibility": "Public"
}

A request to GET /v1.0/groups/{group-id}/planner/plans does not retrieve any plans.

As far as I know, after creating a Group, a Plan will be created too. On the web interface you can see that this plan is correctly created and shown, but it does not appear in JSON response:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.plannerPlan)",
    "@odata.count": 0,
    "value": []
}

After clicking on it in the web interface you can easily get the plan using the request above.

Is it ok to do such magic steps to fetch plan id?


回答1:


The Web App is provisioning the Group's Plan the first time you attempt to access it. When creating a Group through the API however, you'll need to create a new Plan yourself:

POST https://graph.microsoft.com/v1.0/planner/plans
Content-type: application/json

{
  "owner": "group-id",
  "title": "title-value"
}

Keep in mind this important note from the documentation:

When creating a new plan, make a group its owner by simply setting the owner property on a plan object.



来源:https://stackoverflow.com/questions/49494611/microsoft-graph-does-not-retrieve-the-groups-plan-id

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!