Basically I want to know which group contains the plan I am using. I know how to get which plans are in a group:
GET https://graph.microsoft.com/v1.0/groups/{group-id}/planner/plans
But not, given a plan, how to know which group contains it.
Why do I need it? Because I have a plan, with its planner tasks, and I want to add a comment in it programatically. To add a comment we must do this:
POST /groups/{id}/conversations/{id}/threads
So, I need the GroupId, but I only have the PlanId (well, and the Plan object).
Does anybody know how can I get the GroupId from the Plan?
Thank you
In Beta, Plan has a container
property. Looking at that you can tell when the Plan is in a group (vs. something else) and the id of the group. You also get the URL to the group itself. Reference:
https://learn.microsoft.com/en-us/graph/api/resources/plannerplan?view=graph-rest-beta
https://learn.microsoft.com/en-us/graph/api/resources/plannerplancontainer?view=graph-rest-beta
In V1. The group id is available in the owner
property of the plan. However, please note that we're deprecating this property in favor of the container
property from beta, since a single id is not capable of expressing different kinds of objects that can contain a Plan anymore. So I'd highly recommend using the beta API for the Plan, and not take a dependency on the owner
. In V1, if the plan is not contained by a group, trying to get a group with the value of owner
property will result in a 404.