Roman Slivinskyi
Roman Slivinskyi

Reputation: 133

Microsoft Graph does not retrieve the Group's Plan Id

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?

Upvotes: 2

Views: 363

Answers (1)

Marc LaFleur
Marc LaFleur

Reputation: 33094

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.

Upvotes: 3

Related Questions