Skip to content

spo group member remove

Removes the specified member from a SharePoint group

Usage

m365 spo group member remove [options]

Options

-u, --webUrl <webUrl>
URL of the site where the SharePoint group is available.
--groupId [groupId]
Id of the SharePoint group from which the user has to be removed. Specify either groupName or groupId, but not both.
--groupName [groupName]
Name of the SharePoint group from which user has to be removed. Specify either groupName or groupId, but not both.
--userName [userName]
The UPN (user principal name, eg. megan.bowen@contoso.com) of the user that needs to be removed. Specify either userName, email, userId, aadGroupId or aadGroupName.
--email [email]
The email of the user to remove as a member. Specify either userName, email, userId, aadGroupId or aadGroupName.
--userId [userId]
The user Id (Id of the site user, eg. 14) of the user to remove as a member. Specify either userName, email, userId, aadGroupId or aadGroupName.
--aadGroupId [aadGroupId]
The object Id of the Azure AD group to remove as a member. Specify either userName, email, userId, aadGroupId or aadGroupName.
--aadGroupName [aadGroupName]
The name of the Azure AD group to remove as a member. Specify either userName, email, userId, aadGroupId or aadGroupName.
-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,md. Default json
--verbose
Runs command with verbose logging
--debug
Runs command with debug logging

Examples

Remove a user from a SharePoint group based on the id on a given web

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

Remove a user from a SharePoint group based on the username on a given web

m365 spo group member remove --webUrl https://contoso.sharepoint.com/sites/SiteA --groupName "Site A Visitors" --email "Alex.Wilber@contoso.com"

Remove a user from a SharePoint group by email.

m365 spo group member remove --webUrl https://contoso.sharepoint.com/sites/SiteA --groupName "Site A Visitors" --userId 14

Remove an Azure AD group from a SharePoint group based on the Azure AD group name on a given web

m365 spo group member remove --webUrl https://contoso.sharepoint.com/sites/SiteA --groupId 5 --aadGroupName "Azure AD Security Group"

Remove an Azure AD group from a SharePoint group based on the Azure AD group ID on a given web

m365 spo group member remove --webUrl https://contoso.sharepoint.com/sites/SiteA --groupName "Site A Visitors" --aadGroupId "5786b8e8-c495-4734-b345-756733960730"

Response

The command won't return a response on success.