Skip to content

New command: spo user ensure #4497

@milanholemans

Description

@milanholemans

Usage

m365 spo user ensure [options]

Description

Ensures that a user is available on a specific site

Options

Option Description
-u, --webUrl <webUrl> Absolute URL of the site.
--aadId [aadId] Azure AD ID of the user. Specify either aadId or name but not both.
--userName [userName] User's UPN (user principal name, e.g. [email protected]). Specify either aadId or userName but not both.

Examples

Ensures a user by its Azure AD ID

m365 spo user ensure --webUrl https://contoso.sharepoint.com/sites/project --aadId e254750a-eaa4-44f6-9517-b74f65cdb747

Ensures a user by its user principal name

m365 spo user ensure --webUrl https://contoso.sharepoint.com/sites/project --userName [email protected]

Default properties

No response

Additional Info

Extra info

I choose aadId instead of id so it doesn't get mixed up with the SP user ID.
When aadId is specified, we should lookup the UPN of the user in order to ensure this user because as far as I know, you can only ensure users with their logon name.

API request

POST https://contoso.sharepoint.com/sites/project/_api/Web/EnsureUser
Accept: application/json;odata=nometadata
{
    "logonName": "[email protected]"
}

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions