0

How do users add in Office 365 Group using MS Graph API or Powershell?

3 Answers 3

0

Try below:

  1. Identity --> The identity number of the group. $groupId = 02bd9fd6-8f93-4758-87c3-1fb73740a315

  2. Members --> The array UPN values of members to set to the group. It will replace all the existing members. $members = @('[email protected]','[email protected]')

PnP PowerShell to add users as members in the Office 365 group:

Set-PnPUnifiedGroup -Identity $groupId -Members $members
0

To add users to the Office 365 Group, you need to use members navigation property.

Example : If the group id to which you need to add member is 02bd9fd6-8f93-4758-87c3-1fb73740a315. Then you need to use below POST query to add [email protected] user to the group.

POST https://graph.microsoft.com/v1.0/groups/02bd9fd6-8f93-4758-87c3-1fb73740a315/members/$ref
Content-type: application/json

{
  "@odata.id": "https://graph.microsoft.com/v1.0/[email protected]"
}

Powershell

Add-UnifiedGroupLinks –Identity "[email protected]" –LinkType "Members" –Links "[email protected]"

Adding User to Group using Powershell

1
  • using pnp powershell. how can we add?
    – Liz
    Sep 14, 2020 at 11:21
0

@Liz,

You can add user to a group via following methods:

  1. Office 365 cli
  2. MS Graph API: https://docs.microsoft.com/en-us/graph/api/group-post-members?view=graph-rest-1.0&tabs=http#example-1-add-a-member-to-a-group
  3. AzureAD powershell for Graph: Add-AzureADGroupMember, Installing the Azure AD Module
  4. MSOnline V1 PowerShell Add-MsolGroupMember

BR

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.