다음을 통해 공유


ProfileSubtypeManager Class

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

Inheritance Hierarchy

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

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

Syntax

'Declaration
<SharePointPermissionAttribute(SecurityAction.Demand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public Class ProfileSubtypeManager
'Usage
Dim instance As ProfileSubtypeManager
[SharePointPermissionAttribute(SecurityAction.Demand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public class ProfileSubtypeManager

Remarks

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);
            }
        }
    }
}

Thread Safety

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

See Also

Reference

ProfileSubtypeManager Members

Microsoft.Office.Server.UserProfiles Namespace