SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A few custom properties have been added to the user object via CA. I would I retrieve these fields programmatically?


     UserProfileManager mgr = new UserProfileManager(SpServiceContext.current);
     UserProfile user = mgr.GetUserProfile(bool);
     String str = (string)user["fields"].Value;
share|improve this question
I think you should change the title, because it's not the SPUser class that you were interested in, in the first place. – Norbert Dec 12 '12 at 16:26
Will do, but it is the information of the spuser I wanter but I believe I still get the values using the userprofile/userprofile manager – user13186 Dec 12 '12 at 16:43
up vote 0 down vote accepted

I presume your talking about the code below?

SPSite oSiteCollection = SPContext.Current.Site;
using (SPWeb oWebsite = oSiteCollection.AllWebs["Website_Name"])
    SPUser oUser = oWebsite.AllUsers["User_Name"];

    string E-mail_Address = oUser.Email;
    string Display_Name = oUser.Name;
    string User_Notes = oUser.Notes;

    string cutomProp = oUser.CustomeMade;


did you add to Microsoft.SharePoint.SPUser? if you have, build save the Microsoft.SharePoint.SPUser. In your project add reference to the new dll (navigate to the folder and goto the bin folder with the updates).

You should now see your changes in the project ;)...... that is if it what your looking for ;)

hope it helps :)

share|improve this answer

You retrieve and set the custom properties the same as any other attribute in the profile property bag.

Here is a powershell script written to import CSV into the User Properties, works for standard and custom fields:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.