I would like to know how to change the display order of the out of the box user profile properties using sharepoint object model ?

I would like to move OOTB properties into my custom section.

1 Answer 1


Take a look at Property Class

There are two types of user profile properties:

Regular - Defines the property data type and the corresponding user profile flags.

Section - Property that serves as a separator for user interface grouping purposes.

In order to move properties 'into' section you just need to reorder them.

I am providing a little example on how to create new section and then move few OOTB properties 'into' it by simple reorder. Check code comments for clarification.

var customSectionDisplayName = "My New CustomSection";
// For 'internal' name remove whitespace
var customSectionName = customSectionDisplayName.Replace(" ", "");

using (SPSite site = new SPSite("http://mycoolsite"))
    SPServiceContext context = SPServiceContext.GetContext(site);
    // There are just 'few' managers we need
    UserProfileConfigManager upcm = new UserProfileConfigManager(context);
    ProfilePropertyManager ppm = upcm.ProfilePropertyManager;
    CorePropertyManager cpm = ppm.GetCoreProperties();
    ProfileTypePropertyManager ptpm = ppm.GetProfileTypeProperties(ProfileType.User);
    ProfileSubtypeManager psm = ProfileSubtypeManager.Get(context);
    ProfileSubtype ps = psm.GetProfileSubtype(ProfileSubtypeManager.GetDefaultProfileName(ProfileType.User));
    ProfileSubtypePropertyManager pspm = ps.Properties;

    // Check if section already exist
    if(cpm.GetSectionByName(customSectionName) == null)
        // Add new section
        CoreProperty section = cpm.Create(true);
        section.Name = customSectionName;
        section.DisplayName = customSectionDisplayName;
        ProfileTypeProperty profileSection = ptpm.Create(section);
        ProfileSubtypeProperty profileSubSection = pspm.Create(profileSection);
        profileSubSection.DefaultPrivacy = Privacy.Private;

    // In default configuration Custom Properties are the last section 
    // with display order value of 5500
    // Let's move our new section to the end
    pspm.SetDisplayOrderBySectionName(customSectionName, 6000);

    // And now let's move some core properties 
    // Work Email ...
    pspm.SetDisplayOrderByPropertyName(PropertyConstants.WorkEmail, 6100);
    // ... and Work Phone 
    pspm.SetDisplayOrderByPropertyName(PropertyConstants.WorkPhone, 6200);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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