Share via


UserProfileManager Class

The UserProfileManager class is a collection of UserProfile objects. This class is used to access user profile data. To access a specific user profile, call the UserProfileManager class to create a UserProfile object and retrieve the corresponding data from the user profile database.

System.Object

   Microsoft.SharePoint.Portal.UserProfiles.UserProfileManager

Public Constructors

The following table shows the constructors of the UserProfileManager class and a brief description of each.

Name Description
UserProfileManager Initializes a new instance of the UserProfileManager class. When executed on a portal web page, this constructor will use the portal context from the portal being browsed.
UserProfileManager(Microsoft.SharePoint.Portal.PortalContext) Initializes a new instance of the UserProfileManager class with the specified portal context.

Public Methods

The following table shows the public methods of the UserProfileManager class and a brief description of each.

Name Description
CreateUserProfile(String) Creates a user profile with the specified account name
CreateUserProfile(String, String) Creates a user profile with the specified account name and preferred name
CreateUserProfile Creates a user profile for the current user
GetEnumerator Gets an enumerator of all UserProfile objects within this portal context
GetUserProfile(Boolean) Gets the UserProfile object of the current user or creates one if the UserProfile object does not already exist
GetUserProfile(Byte[]) Gets the UserProfile object for the specified SID in byte[] format
GetUserProfile(String) Gets the UserProfile object for the specified account name
GetUserProfile(System.Guid) Gets the UserProfile object for the specified GUID
RemoveUserProfile(String) Removes the user profile, quick links, and alert data from the user profile database for the specified account name
RemoveUserProfile(System.Guid) Removes the user profile, quick links, and alert data from the user profile database for the specified GUID
UserExists(String) Returns a value indicating whether the user for a specifed account name has a user profile

Public Properties

The following table shows the properties of the UserProfileManager class, the data type of each property, and a brief description of each.

Name Data Type Description
AccountNameFormat Microsoft.SharePoint.Portal.UserProfiles.UserFormat Gets the format of the user name.
Count Int64 Gets the number of user profiles stored in the user profile database specified by the portal site.
PersonalSiteFormat Microsoft.SharePoint.Portal.UserProfiles.SiteNameFormat Gets the site naming format used to create personal sites.
PersonalSiteInclusion String Gets the inclusion (managed path) that is used to create personal sites.
PersonalSiteReaders String Gets the list of users who are added as readers when creating personal sites
Properties Microsoft.SharePoint.Portal.UserProfiles.PropertyCollection Gets the schema manager required to enumerate through all defined properties.
PropertiesWithSection Microsoft.SharePoint.Portal.UserProfiles.PropertyCollection Gets the schema manager required to enumerate through all defined properties and sections.

Thread Safety

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

Remarks

You must create the UserProfileManager object before accessing a UserProfile object. You can then retrieve the user profiles to which the user has access. Full access to everyone's user profile requires "Manage User Profiles" rights. Full access to your own profile requires "Use Personal Features" rights. Everyone has read access to all profiles.

You must use the UserProfileConfigManager Class object instead of the UserProfileManager object to manage meta data. The meta data access provided by theUserProfileManager object is meant to be read-only.

Example

The following code example shows the use of the UserProfileManager class.

Requirements

Namespace: Microsoft.SharePoint.Portal.UserProfiles

Platforms: Windows Server 2003

Assembly: Microsoft.SharePoint.Portal (in Microsoft.SharePoint.Portal.dll)

Security: Code Access Security