This project has moved and is read-only. For the latest updates, please go here.

Getting additional profile fields that are synced with AD

Aug 14, 2013 at 4:18 PM
Edited Aug 14, 2013 at 4:18 PM

Will the next version of .SPGetCurrentUser be able to return custom properties held in a user's profile that are synced with AD ( through the usual UPS)?

For example:
var company = $().SPServices.SPGetCurrentUser({
fieldName: "Company",
debug: true
I guess my interest is both in SharePoint 2010 and 2013
Aug 14, 2013 at 8:09 PM
If the values are you are looking for are fields on the user profile page, then they should be accessible now... As the documentation states, this utility:
"...does an AJAX call to grab /_layouts/userdisp.aspx?Force=True and "scrapes" the values from the page based on the internal field name (aka StaticName)."
So take a look at the /_layouts/userdisp.aspx?Force=True and if the values you are looking for are displayed there, you can use the Internal field name to retrieve it.
Aug 16, 2013 at 11:20 AM
Edited Aug 16, 2013 at 11:28 AM

Thanks for the reply. Now, in my case I updated the company property in AD via PS script then did a sync with a custom property in Sp2010 though UPS

When I go to Edit User Profile property for the custom property: Company I have the following settings
  • Do not allow users to edit values for this property
  • Checked Show in the profile properties section of the user's profile page
  • Checked Show on the Edit Details page
  • Checked Show updates to the property in newsfeed
Source Attribute Direction
MyAD Company Import

However, /_layouts/userdisp.aspx does not have the company property which is why the SPGetCurrentUser does not return anything

However it is displayed both in and layouts/ProfAdminEdit.aspx ( Edit user property in CA)

I guess the question is how can I get my custom property to appear in the user settings
Aug 17, 2013 at 7:02 PM
Not sure how you can do that (adding additional data to userdisp.aspx). Since that's no longer a SPServices question, if no one else has any feedback, I would suggest posting your question to StackExchange.


Sent from mobile device.
Aug 17, 2013 at 10:54 PM

Thanks for your reply. I think that is a good suggestion. I will follow up and let you know.

Aug 29, 2013 at 11:03 PM

There's a difference between the User Profile and the userdisp.aspx info. The latter is present for all users who have "touched" the Site Collection, regardless the license level. i.e., even for Foundation.

If you want to access the User Profile properties, you should use the User Profile Service instead.

Sep 2, 2013 at 2:50 PM
Edited Sep 2, 2013 at 2:56 PM

Thanks for your explanation. The userdisp.aspx seem to be a fixed set of properties for those users who as you say have "touched" the site collection. Assuming, I can't add my custom AD property "Company" to this page then I am left with some options I need to explore on my test SP2010 server in order to extract the company name stored as custom user profile property and synced with AD.
  operation: "GetUserProfileByName",
  async: false,
  AccountName: "Mydomain\\Dantheman",
  completefunc: function (xData, Status) {
    company = getUPValue(xData.responseXML, "Company");
or maybe this

[](SP.People function)

Any thoughts before I try both out.
Sep 2, 2013 at 5:00 PM
Assuming your getUPValue function works, that's the way to go.

Sep 2, 2013 at 10:21 PM

Spot on, with GetUserProfleByName() I was able to locate the Company custom AD attribute . I didn't bother with the AcountName parameter which defaulted to my current user. I then copied the "Company" name string to a variable and displayed it on my sample home page I have used in my latest blog post which I will update with this tomorrow. Thanks once again for getting me on track.