Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save princeppy/036fcbc3734b7fbced0ff6abd130a19c to your computer and use it in GitHub Desktop.

Select an option

Save princeppy/036fcbc3734b7fbced0ff6abd130a19c to your computer and use it in GitHub Desktop.
SharePoint Online: Set Mutli Value User Profile property with REST API
(function ($) {
'use strict';
var requestHeaders = {
'X-RequestDigest': $("#__REQUESTDIGEST").val(),
"accept": "application/json; odata=nometadata",
"content-type": "application/json;odata=nometadata"
};
var userData = {
'accountName': "i:0#.f|membership|[email protected]",
'propertyName': 'SPS-Skills', //Can also set custom userprofile properties.
'propertyValues': ["SharePoint", "Office 365", "Architecture", "Azure"]
};
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/SP.UserProfiles.PeopleManager/SetMultiValuedProfileProperty",
type: "POST",
headers: requestHeaders,
data: JSON.stringify(userData),
success: function (data) {
console.log(data)
},
error: function (jqxr, errorCode, errorThrown) {
console.log(jqxr.responseText);
}
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment