Skip to content

New command: spo userprofile get #1670

@VelinGeorgiev

Description

@VelinGeorgiev

Usage

spo userprofile get [options]

Description

Get SharePoint user profile for the specified user

Options

Option Description
-u, --userName<userName> Account name of the user
-o, --output [output] Output type. json,text. Default text
--verbose Runs command with verbose logging
--debug Runs command with debug logging

Command example

spo userprofile get --name '[email protected]'

Example for calling the SharePoint UserProfiles APIs.

This is REST action that can be implemented in the command. It uses fetch that will have to change within a CLI command with the request library.

fetch(`https://mytenant.sharepoint.com/sites/finder-en/_api/contextinfo`, {
    headers: {
        "Accept": "application/json;odata=nometadata",
        "Content-type": "application/json;odata=verbose"
    },
    method: "POST"
}).then((response) => {
    if (!response.ok) {
         console.log(response);
    }
    return response.json();
}).then((response) => {
    console.log(response);

    fetch(`https://mytenant.sharepoint.com/sites/finder-en/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='${encodeURIComponent('i:0#.f|membership|[email protected]')}'`, {
        headers: {
            "Accept": "application/json;odata=nometadata",
            "Content-type": "application/json;odata=verbose",
            "X-RequestDigest": response.FormDigestValue
        },
        method: "GET"
    }).then((response) => {
        if (!response.ok) {
            reject(response);
        }
        return response.json();
    }).then((response) => {
        console.log(response);
    })
})

Additional Information

Get-PnPUserProfileProperty - https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/get-pnpuserprofileproperty?view=sharepoint-ps

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions