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;
section.Commit();
ProfileTypeProperty profileSection = ptpm.Create(section);
profileSection.Commit();
ProfileSubtypeProperty profileSubSection = pspm.Create(profileSection);
profileSubSection.DefaultPrivacy = Privacy.Private;
profileSubSection.Commit();
}
// 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);
pspm.CommitDisplayOrder();
// And now let's move some core properties
// Work Email ...
pspm.SetDisplayOrderByPropertyName(PropertyConstants.WorkEmail, 6100);
// ... and Work Phone
pspm.SetDisplayOrderByPropertyName(PropertyConstants.WorkPhone, 6200);
pspm.CommitDisplayOrder();
}