import Global from '/docs/cmd/_global.mdx'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
Gets a site user within specific web
m365 spo user get [options]
`-u, --webUrl <webUrl>`
: URL of the web to get the user within
`-i, --id [id]`
: ID of the user to retrieve information for. Use either `email`, `id` or `loginName`, but not all.
`--email [email]`
: Email of the user to retrieve information for. Use either `email`, `id` or `loginName`, but not all.
`--loginName [loginName]`
: Login name of the user to retrieve information for. Use either `email`, `id` or `loginName`, but not all.
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 the currently logged-in user
m365 spo user get --webUrl https://contoso.sharepoint.com/sites/project-x
{
"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"
}
Email : johndoe@contoso.onmicrosoft.com
Expiration :
Id : 10
IsEmailAuthenticationGuestUser: false
IsHiddenInUI : false
IsShareByEmailGuestUser : false
IsSiteAdmin : false
LoginName : i:0#.f|membership|johndoe@contoso.onmicrosoft.com
PrincipalType : 1
Title : John Doe
UserId : {"NameId":"100320022ec308a7","NameIdIssuer":"urn:federation:microsoftonline"}
UserPrincipalName : johndoe@contoso.onmicrosoft.com
Id,IsHiddenInUI,LoginName,Title,PrincipalType,Email,Expiration,IsEmailAuthenticationGuestUser,IsShareByEmailGuestUser,IsSiteAdmin,UserId,UserPrincipalName
10,,i:0#.f|membership|johndoe@contoso.onmicrosoft.com,John Doe,1,johndoe@contoso.onmicrosoft.com,,,,,"{""NameId"":""100320022ec308a7"",""NameIdIssuer"":""urn:federation:microsoftonline""}",johndoe@contoso.onmicrosoft.com
# spo user get --webUrl "https://contoso.sharepoint.com" --loginName "i:0#.f|membership|john.doe@contoso.onmicrosoft.com"
Date: 4/10/2023
## John Doe (9)
Property | Value
---------|-------
Id | 10
IsHiddenInUI | false
LoginName | i:0#.f\|membership\|john.doe@contoso.onmicrosoft.com
Title | Reshmee Auckloo
PrincipalType | 1
Email | john.doe@contoso.onmicrosoft.com
Expiration |
IsEmailAuthenticationGuestUser | false
IsShareByEmailGuestUser | false
IsSiteAdmin | false
UserPrincipalName | john.doe@contoso.onmicrosoft.com