Skip to main content

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.

Can you not just use the built in forms functionality:

Lookup user profile data from SharePoint. userProfileLookup("domainlogin", "InternalPropertyName") available with formula builder in a calculated value?


I suppose so, but if I needed to retrieve several properties wouldn't it be more efficient to do so with a single query, rather than several 'userProfileLookup' calls?


Reply