Skip to main content

spe container permission add

Adds permission to SharePoint Embedded container for a specified user

Usage​

m365 spe container permission add [options]

Options​

-i, --containerId [containerId]

ID of a SharePoint Embedded container. Specify either containerId or containerName but not both.

-n, --containerName [containerName]

Display name of the Container. Specify either containerId or containerName but not both.

--containerTypeId [containerTypeId]

The ID of the container type. Specify either containerTypeId or containerTypeName when using containerName but not both.

--containerTypeName [containerTypeName]

The name of the container type. Specify either containerTypeId or containerTypeName when using containerName but not both.

-r, --roles <roles>

Comma-separated list of roles. Possible values are reader, writer, manager, owner.

--userId [userId]

The ID of the user to assign the role to. Use either userId or userName but not both.

--userName [userName]

The UPN of user to assign the role to. Use either userId or userName but not both.

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, permissions, response, full. Default is options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--verbose

Runs command with verbose logging.

--debug

Runs command with debug logging.

Permissions​

ResourcePermissions
Microsoft GraphFileStorageContainer.Selected
note

When using --userId, Microsoft Graph also requires User.ReadBasic.All for delegated authentication or User.Read.All for application authentication to resolve the user's principal name.

note

When using --containerTypeName, resolving the container type requires delegated authentication, the FileStorageContainerType.Manage.All permission, and the SharePoint Administrator or Global Administrator role. For application authentication, use --containerId, or --containerName with --containerTypeId, instead.

Examples​

Adds a reader role for the specified user to the container

m365 spe container permission add --containerId "b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z" --roles "reader" --userName "jacob@fabrikam.com"

Adds multiple roles for the specified user to the container

m365 spe container permission add --containerId "b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z" --roles "reader,writer" --userName "jacob@fabrikam.com"

Response​

{
"id": "cJpbmNpcGFsT3duZAJfaLowIy5mfG1lbWJliZXJzaGlwfHJvcnlicjExMUBvdXRsb29rLmNvbQ",
"roles": ["reader"],
"grantedToV2": {
"user": {
"id": "89ea5c94-7736-4e25-95ad-3fa95f62b66e",
"userPrincipalName": "john.doe@contoso.com",
"displayName": "John Doe",
"email": "john.doe@contoso.com"
}
}
}