Skip to content

spo group member add

Add members to a SharePoint Group

Usage

m365 spo group member add [options]

Options

-u, --webUrl <webUrl>
URL of the site where the SharePoint group is available
--groupId [groupId]
Id of the SharePoint Group to which the user needs to be added, specify either groupId or groupName
--groupName [groupName]
Name of the SharePoint Group to which the user needs to be added, specify either groupId or groupName
--userName [userName]
User's UPN (user principal name, eg. megan.bowen@contoso.com). If multiple users need to be added, they have to be comma separated (ex. megan.bowen@contoso.com,alex.wilber@contoso.com), specify either userName or email
--email [email]
User's email (eg. megan.bowen@contoso.com). If multiple users need to be added, they have to be comma separated (ex. megan.bowen@contoso.com,alex.wilber@contoso.com), specify either userName or email
-h, --help [help]
Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, response, full. Default is full.
--query [query]
JMESPath query string. See http://jmespath.org/ for more information and examples
-o, --output [output]
Output type. json,text,csv. Default json
--verbose
Runs command with verbose logging
--debug
Runs command with debug logging

Remarks

For the --userName or --email options you can specify multiple values by separating them with a comma. If one of the specified entries is not valid, the command will fail with an error message showing the list invalid values.

Examples

Add a user with name Alex.Wilber@contoso.com to the SharePoint group with id 5 available on the web https://contoso.sharepoint.com/sites/SiteA

m365 spo group member add --webUrl https://contoso.sharepoint.com/sites/SiteA --groupId 5 --userName "Alex.Wilber@contoso.com"

Add multiple users by name to the SharePoint group with id 5 available on the web https://contoso.sharepoint.com/sites/SiteA

m365 spo group member add --webUrl https://contoso.sharepoint.com/sites/SiteA --groupId 5 --userName "Alex.Wilber@contoso.com, Adele.Vance@contoso.com"

Add a user with email Alex.Wilber@contoso.com to the SharePoint group with name Contoso Site Owners available on the web https://contoso.sharepoint.com/sites/SiteA

m365 spo group member add --webUrl https://contoso.sharepoint.com/sites/SiteA --groupName "Contoso Site Owners" --email "Alex.Wilber@contoso.com"

Add multiple users by email to the SharePoint group with name Contoso Site Owners available on the web https://contoso.sharepoint.com/sites/SiteA

m365 spo group member add --webUrl https://contoso.sharepoint.com/sites/SiteA --groupName "Contoso Site Owners" --email "Alex.Wilber@contoso.com, Adele.Vance@contoso.com"