Usage
spo userprofile set [options]
Description
Sets user profile property for a SharePoint user
Options
| Option |
Description |
-u, --userName <userName> |
Account name of the user |
-n, --propertyName <propertyName> |
The property name of the property to be be set |
-v, --propertyValue <propertyValue> |
The value of the property to be set |
-o, --output [output] |
Output type. json,text. Default text |
--verbose |
Runs command with verbose logging |
--debug |
Runs command with debug logging |
Command example
Updates single value property of a user profile with property name SPS-JobTitle and property value 'Senior Developer'
spo userprofile set --name '[email protected]' --propertyName 'SPS-JobTitle' --propertyValue 'Senior Developer'
Updates multi value property of a user profile with property name SPS-Skills and property values 'CSS', 'HTML'
spo userprofile set --name '[email protected]' --propertyName 'SPS-Skills' --propertyValue 'CSS','HTML'
Remarks
This command requires tenant admin permissions in case of updating properties other than the current logged user.
Example for calling the SharePoint UserProfiles APIs.
This is REST request for updating a single value property 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/SetSingleValueProfileProperty`, {
headers: {
"Accept": "application/json;odata=nometadata",
"Content-type": "application/json;odata=verbose",
"X-RequestDigest": response.FormDigestValue
},
method: "POST",
body: JSON.stringify({
'accountName': "i:0#.f|membership|[email protected]",
'propertyName': "finderCommunityOfPracticeBody1",
'propertyValue': "Velin Test gfdgf"
})
}).then((response) => {
if (!response.ok) {
console.log(response);
}
return response.json();
}).then((response) => {
console.log(response);
})
})
This is REST request for updating a multi value property 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) {
this.handleResponseError(response);
reject(response);
}
return response.json();
}).then((response) => {
console.log(response);
fetch(`https://mytenant.sharepoint.com/sites/finder-en/_api/SP.UserProfiles.PeopleManager/SetMultiValuedProfileProperty`, {
headers: {
"Accept": "application/json;odata=nometadata",
"Content-type": "application/json;odata=verbose",
"X-RequestDigest": response.FormDigestValue
},
method: "POST",
body: JSON.stringify({
'accountName': "i:0#.f|membership|[email protected]",
'propertyName': "finderSkills",
'propertyValues': ["Technology1", "Written Communication2"]
})
}).then((response) => {
if (!response.ok) {
console.log(response);
}
return response.json();
}).then((response) => {
console.log(response);
})
})
Additional Information
Set-PnPUserProfileProperty - https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/set-pnpuserprofileproperty?view=sharepoint-ps
Usage
spo userprofile set [options]Description
Sets user profile property for a SharePoint user
Options
-u, --userName <userName>-n, --propertyName <propertyName>-v, --propertyValue <propertyValue>-o, --output [output]json,text. Defaulttext--verbose--debugCommand example
Updates single value property of a user profile with property name SPS-JobTitle and property value 'Senior Developer'
Updates multi value property of a user profile with property name SPS-Skills and property values 'CSS', 'HTML'
Remarks
This command requires tenant admin permissions in case of updating properties other than the current logged user.
Example for calling the SharePoint UserProfiles APIs.
This is REST request for updating a single value property that can be implemented in the command. It uses fetch that will have to change within a CLI command with the request library.
This is REST request for updating a multi value property that can be implemented in the command. It uses fetch that will have to change within a CLI command with the request library.
Additional Information
Set-PnPUserProfileProperty - https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/set-pnpuserprofileproperty?view=sharepoint-ps