Skip to content

Latest commit

 

History

History
163 lines (122 loc) · 4.67 KB

File metadata and controls

163 lines (122 loc) · 4.67 KB

import Global from '../../_global.mdx'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

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. [email protected]). 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`.

Examples

Get user by email for a web.

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

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|[email protected]"

Get user by user's UPN for a web.

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

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|[email protected]",
  "Title": "John Doe",
  "PrincipalType": 1,
  "Email": "[email protected]",
  "Expiration": "",
  "IsEmailAuthenticationGuestUser": false,
  "IsShareByEmailGuestUser": false,
  "IsSiteAdmin": false,
  "UserId": {
    "NameId": "100320022ec308a7",
    "NameIdIssuer": "urn:federation:microsoftonline"
  },
  "UserPrincipalName": "[email protected]"
}
Email                         : [email protected]
Expiration                    :
Id                            : 10
IsEmailAuthenticationGuestUser: false
IsHiddenInUI                  : false
IsShareByEmailGuestUser       : false
IsSiteAdmin                   : false
LoginName                     : i:0#.f|membership|[email protected]
PrincipalType                 : 1
Title                         : John Doe
UserId                        : {"NameId":"100320022ec308a7","NameIdIssuer":"urn:federation:microsoftonline"}
UserPrincipalName             : [email protected]
Id,IsHiddenInUI,LoginName,Title,PrincipalType,Email,Expiration,IsEmailAuthenticationGuestUser,IsShareByEmailGuestUser,IsSiteAdmin,UserId,UserPrincipalName
10,,i:0#.f|membership|[email protected],John Doe,1,[email protected],,,,,"{""NameId"":""100320022ec308a7"",""NameIdIssuer"":""urn:federation:microsoftonline""}",[email protected]
# spo user get --webUrl "https://contoso.sharepoint.com" --loginName "i:0#.f|membership|[email protected]"

Date: 4/10/2023

## John Doe (9)

Property | Value
---------|-------
Id | 10
IsHiddenInUI | false
LoginName | i:0#.f\|membership\|[email protected]
Title | Reshmee Auckloo
PrincipalType | 1
Email | [email protected]
Expiration | 
IsEmailAuthenticationGuestUser | false
IsShareByEmailGuestUser | false
IsSiteAdmin | false
UserPrincipalName | [email protected]