Skip to content

New command: spo group set #3485

@milanholemans

Description

@milanholemans

Usage

m365 spo group set

Description

Updates a group in the specified site

Options

Option Description
-u, --webUrl <webUrl> URL of the site where the group is located.
-i, --id [id] Id of the group to update. Specify either id or name but not both.
-n, --name [name] Name of the group. Specify either id or name but not both.
--newName [newName] New name for the group.
--description [description] The description for the group.
--allowMembersEditMembership [allowMembersEditMembership] Who can edit the membership of the group? When true members can edit membership, otherwise only owners can do this.
--onlyAllowMembersViewMembership [onlyAllowMembersViewMembership] Who can view the membership of the group? When true only group members can view the membership, otherwise everyone can.
--allowRequestToJoinLeave [allowRequestToJoinLeave] Specify whether to allow users to request membership in this group and allow users to request to leave the group.
--autoAcceptRequestToJoinLeave [autoAcceptRequestToJoinLeave] If auto-accept is enabled, users will automatically be added or removed when they make a request.
--requestToJoinLeaveEmailSetting [requestToJoinLeaveEmailSetting] All membership requests will be sent to the e-mail address specified.
--ownerEmail [ownerEmail] Set user with this email as owner of the group. Specify either ownerEmail or ownerUserName but not both.
--ownerUserName [ownerUserName] Set user with this login name as owner of the group. Specify either ownerEmail or ownerUserName but not both.

Examples

Update group title and description

m365 spo group set --webUrl https://contoso.sharepoint.com/sites/project-x --id 18 --newTitle "Project contributors" --description "This group contains all project contributors"

Update group with membership requests

m365 spo group set --webUrl https://contoso.sharepoint.com/sites/project-x --title "Project leaders" --allowRequestToJoinLeave true --requestToJoinLeaveEmailSetting [email protected]

Sets a specified user as group owner by group ID

m365 spo group set --webUrl https://contoso.sharepoint.com/sites/project-x --id 18 --ownerEmail [email protected]

Additional Info

Update group:

PATCH https://contoso.sharepoint.com/sites/project-x/_api/web/sitegroups(<id>)
Accept: application/json
Content-Type: application/json

{
    "Title": "New Site Group",
    "Description": "New Site Group description",
    "AllowMembersEditMembership": false,
    "OnlyAllowMembersViewMembership": false,
    "AllowRequestToJoinLeave": false,
    "AutoAcceptRequestToJoinLeave": false,
    "RequestToJoinLeaveEmailSetting": "[email protected]"
}

Set owner:

POST https://contoso.sharepoint.com/sites/project-x/_api/web/sitegroups(<group id>)/SetUserAsOwner(<user id>)
Accept: application/json
Content-Type: application/json

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions