1

I would like to know how to add a user as a member to a Microsoft Planner Plan using Microsoft Graph API and PowerShell. I know that the membership to a plan is ruled by the membership to the M365 Group. The user is already the owner of the group to which the planner belongs but still, he can not see the plan into his plan list.

How to do this? What do I miss here?

I did not find any example of how to achieve this.

The group is already created and cannot be created only to create the plan as well.

If you find a solution that allows me to add the users during the creation of the plan I'll be more than happy to see it as well. Here is the snippet I am using to create the plan. It is working perfectly.

$uri = "https://graph.microsoft.com/beta/planner/plans"
$GroupID="GUID of the group"
$UserAccessToken="token generated and working"
$headers = @{"Authorization" = "Bearer $UserAccessToken" }
$planTitle = "My plan"
$body = @{ 
  "owner" = "$GroupID"; 
  "title" = "$planTitle"
}
$fbody = ConvertTo-Json -InputObject $body
$response = Invoke-RestMethod -Method Post -Uri $uri -Headers $headers -Body $fbody -ContentType "application/json"

Thank you

1 Answers1

1

Owners and members of a group are separate. It sounds like in your case the user is an owner, but not a member. Planner currently allows operations on plans (including their creation) for members of the group. Someone who is an owner, but not a member, will not have permissions. We're working on improving this by allowing owners to also have permissions. Until then you can resolve the issue by adding the user to the members list (as an owner, they will have permission to add themselves as a member).

Tarkan Sevilmis
  • 1,443
  • 7
  • 9