Last active
May 16, 2019 17:01
-
-
Save vman/7d8bc0fb980a63fbdd732e3a2173493d to your computer and use it in GitHub Desktop.
SharePoint Online: Set Mutli Value User Profile property with REST API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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); |
Hi vman, Thank you for your example. I used the same approach in MS Flow and it works great so far but I'm not able to update user profile properties of guest user's in SharePoint Online. I'm gettting the error "403 - Access Denied".
Do you know if perhaps this is a known restrictions or if it should work?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
trying to replicate this functionality via workflows in SharePoint designer, using the call http web service method. Single property works fine, but with this function I get the following error, ever seen it?
When trying to read a null collection parameter value in JSON Light, a node of type 'PrimitiveValue' with the value '["SharePoint", "Office 365", "Architecture", "Azure"]' was read from the JSON reader; however, a primitive 'null' value was expected.