Skip to main content

spo user get

Gets a site user within specific web

Usage

m365 spo user get [options]

Options

-u, --webUrl <webUrl>

URL of the web to get the user within.

-i, --id [id]

ID of the user to retrieve information for. Specify either id, loginName, email, userName, entraGroupId, or entraGroupName.

--email [email]

Email of the user to retrieve information for. Specify either id, loginName, email, userName, entraGroupId, or entraGroupName.

--loginName [loginName]

Login name of the user to retrieve information for. Specify either id, loginName, email, userName, entraGroupId, or entraGroupName.

--userName [userName]

User's UPN (user principal name, eg. megan.bowen@contoso.com). Specify either id, loginName, email, userName, entraGroupId, or entraGroupName.

--entraGroupId [entraGroupId]

The object ID of the Microsoft Entra group. Specify either id, loginName, email, userName, entraGroupId, or entraGroupName.

--entraGroupName [entraGroupName]

The name of the Microsoft Entra group. Specify either id, loginName, email, userName, entraGroupId, or entraGroupName.

-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 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.

Examples

Get user by email for a web.

m365 spo user get --webUrl https://contoso.sharepoint.com/sites/project-x --email john.doe@mytenant.onmicrosoft.com

Get user by ID for a web.

m365 spo user get --webUrl https://contoso.sharepoint.com/sites/project-x --id 6

Get user by login name for a web.

m365 spo user get --webUrl https://contoso.sharepoint.com/sites/project-x --loginName "i:0#.f|membership|john.doe@mytenant.onmicrosoft.com"

Get user by user's UPN for a web.

m365 spo user get --webUrl https://contoso.sharepoint.com/sites/project-x --userName "john.doe@mytenant.onmicrosoft.com"

Get user by entraGroupId for a web.

m365 spo user get --webUrl https://contoso.sharepoint.com/sites/project-x --entraGroupId f832a493-de73-4fef-87ed-8c6fffd91be6

Get user by entraGroupName for a web.

m365 spo user get --webUrl https://contoso.sharepoint.com/sites/project-x --entraGroupName "Test Members"

Get the currently logged-in user.

m365 spo user get --webUrl https://contoso.sharepoint.com/sites/project-x

Response

{
"Id": 10,
"IsHiddenInUI": false,
"LoginName": "i:0#.f|membership|johndoe@contoso.onmicrosoft.com",
"Title": "John Doe",
"PrincipalType": 1,
"Email": "johndoe@contoso.onmicrosoft.com",
"Expiration": "",
"IsEmailAuthenticationGuestUser": false,
"IsShareByEmailGuestUser": false,
"IsSiteAdmin": false,
"UserId": {
"NameId": "100320022ec308a7",
"NameIdIssuer": "urn:federation:microsoftonline"
},
"UserPrincipalName": "johndoe@contoso.onmicrosoft.com"
}
CTRL + M