Adding new ProfileSubtypes requires that you know what type of ProfileSubtype you wish to create. There are 3 different ProfileTypes to choose from: Organization, Group, and User. The explanation of the different ProfileTypes can be found here. The SPSite represents a site that has the UserProfileServiceApplication attached to it. The code needed to create a ProfileSubtype is shown below.
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode, .ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode pre
{font-size:small;color:black;font-family:consolas, “Courier New”, courier, monospace;background-color:#ffffff;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode pre
{margin:0em;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .rem
{color:#008000;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .kwrd
{color:#0000ff;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .str
{color:#006080;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .op
{color:#0000c0;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .preproc
{color:#cc6633;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .asp
{background-color:#ffff00;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .html
{color:#800000;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .attr
{color:#ff0000;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .alt
{background-color:#f4f4f4;width:100%;margin:0em;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .lnum
{color:#606060;}
There are 2 different approaches available to define the profile properties to include in ProfileSubtypes. This is due to the fact that when a new ProfileSubtype is added, all properties that are in the default ProfileSubtype are added to the newly created one.
Approach 1:
The first approach should be used if you have yet to create any custom properties that will be shown or hidden by a ProfileSubtype. In this case, it would be better to create a the subtypes before creating the rest of the profile properties then adding those that belong to that ProfileSubtype after the property is created. This is easier to create as you will just need to know what properties you want to show for that specific ProfileSubtype. The code needed to add profile properties to ProfileSubtypes is shown below.
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode, .ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode pre
{font-size:small;color:black;font-family:consolas, “Courier New”, courier, monospace;background-color:#ffffff;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode pre
{margin:0em;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .rem
{color:#008000;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .kwrd
{color:#0000ff;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .str
{color:#006080;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .op
{color:#0000c0;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .preproc
{color:#cc6633;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .asp
{background-color:#ffff00;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .html
{color:#800000;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .attr
{color:#ff0000;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .alt
{background-color:#f4f4f4;width:100%;margin:0em;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .lnum
{color:#606060;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode, .ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode pre
{font-size:small;color:black;font-family:consolas, “Courier New”, courier, monospace;background-color:#ffffff;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode pre
{margin:0em;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .rem
{color:#008000;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .kwrd
{color:#0000ff;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .str
{color:#006080;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .op
{color:#0000c0;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .preproc
{color:#cc6633;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .asp
{background-color:#ffff00;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .html
{color:#800000;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .attr
{color:#ff0000;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .alt
{background-color:#f4f4f4;width:100%;margin:0em;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .lnum
{color:#606060;}
Approach 2:
The second approach should be used if the user profile properties have already been created. After creating the new ProfileSubtype, removing the properties that should not be in the ProfileSubtype is necessary to define the view. The list of properties required for this approach is all of the properties that should not be in the ProfileSubtype. The code needed to remove the profile properties from a ProfileSubtype is shown below.
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode, .ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode pre
{font-size:small;color:black;font-family:consolas, “Courier New”, courier, monospace;background-color:#ffffff;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode pre
{margin:0em;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .rem
{color:#008000;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .kwrd
{color:#0000ff;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .str
{color:#006080;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .op
{color:#0000c0;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .preproc
{color:#cc6633;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .asp
{background-color:#ffff00;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .html
{color:#800000;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .attr
{color:#ff0000;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .alt
{background-color:#f4f4f4;width:100%;margin:0em;}
.ExternalClass5DBC3E0EE9094ED8895EA79FAE7629DB .csharpcode .lnum
{color:#606060;}