AnsweredAssumed Answered

Getting User Profile Properties via JavaScript

Question asked by michaela on May 30, 2016
Latest reply on May 31, 2016 by michaela

I'm trying to retrieve a number of properties from a user's profile via JavaScript with the intent to populate fields on a form prior to submission.

 

I tried using the MSDN example using the JavaScript object model How to: Retrieve user profile properties by using the JavaScript object model in SharePoint 2013 but I couldn't get it working. I largely suspect that the required "SP.UserProfiles.js" file isn't getting loaded in the following line:

 

// Ensure that the SP.UserProfiles.js file is loaded before the custom code runs.
SP.SOD.executeOrDelayUntilScriptLoaded(getUserProperties, 'SP.UserProfiles.js');

 

I've looked into using the REST API, following examples shown on Vardhaman Deshpande: SharePoint 2013: Get UserProfile Properties with REST API  but the example (no.6) for multiple property retrieval apparently doesn't work.

 

Any ideas, or thoughts, as to how I could get the MSDN JSOM example working? Or alternatively, how to use the REST API to retrieve multiple properties for a given user?

 

Thanks.

Outcomes