Export (0) Print
Expand All

ProfileSubtypeManager class

Creates, deletes, retrieves, and manages profile subtypes for a profile type.

System.Object
  Microsoft.Office.Server.UserProfiles.ProfileSubtypeManager

Namespace:  Microsoft.Office.Server.UserProfiles
Assembly:  Microsoft.Office.Server.UserProfiles (in Microsoft.Office.Server.UserProfiles.dll)

'Declaration
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.Demand, ObjectModel := True)> _
PublicClassProfileSubtypeManager
'Usage
DiminstanceAsProfileSubtypeManager

The following sample demonstrates how to use the ProfileSubtypeManager to create both a user profile and an organization profile ProfileSubtype.

using Microsoft.Office.Server.UserProfiles;
using Microsoft.SharePoint;
 
namespace CreateSubtype
{
    class Program
    {
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite("http://<servername>"))
            {
                SPServiceContext context = SPServiceContext.GetContext(site);
                ProfileSubtypeManager psm = ProfileSubtypeManager.Get(context);
 
                // create a user profile subtype
                psm.CreateSubtype("Consultant", "Consultant Subtype", ProfileType.User);
 
                // create an organization profile subtype
                psm.CreateSubtype("Vendor", "Vendor Subtype", ProfileType.Organization);
            }
        }
    }
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft