UserProfile UserProfile UserProfile Class

Definition

Represents a user profile for a person in the user profile database.

public ref class UserProfile : Microsoft::Office::Server::UserProfiles::ProfileBase
[Microsoft.SharePoint.Client.ClientCallableType(ServerTypeId="A3B3B313-DF8C-4192-B623-57B8FA3872D9")]
public class UserProfile : Microsoft.Office.Server.UserProfiles.ProfileBase
Public Class UserProfile
Inherits ProfileBase
Inheritance
UserProfileUserProfileUserProfile
Attributes
Microsoft.SharePoint.Client.ClientCallableTypeAttribute

Examples

<p>The following code example shows the use of the <xref data-throw-if-not-resolved="true" uid="Microsoft.Office.Server.UserProfiles.UserProfile"></xref> class.</p>
<pre><code>Public Sub UserProfileSample() 

' Get SPSite and service Context
Dim strUrl As String = "http://SampleName"
Dim site as SPSite = new SPSite(strUrl)
Dim serviceContext as SPServiceContext = SPServiceContext.GetContext(site) 'initialize user profile manager object
Dim upm As New UserProfileManager(serviceContext)
'Create user sample
Dim sAccount As String = "mydomain\myalias"
If Not upm.UserExists(sAccount) Then upm.CreateUserProfile(sAccount)
End If
'To set prop values on user profile
Dim u As UserProfile = upm.GetUserProfile(sAccount)
Dim sPropName As String = "PreferredName"
u(sPropName) = sAccount
u.Commit()
'Remove user profile sample
upm.RemoveUserProfile(sAccount)
End Sub 'UserProfileSample
Public Sub CreatePersonalSiteSample()
' Get SPSite and service Context
Dim strUrl As String = "http://SampleName"
Dim site as SPSite = new SPSite(strUrl)
Dim serviceContext as SPServiceContext = SPServiceContext.GetContext(site) 'initialize user profile manager object
Dim upm As New UserProfileManager(serviceContext)
Dim sAccount As String = "mydomain\myalias"
Dim u As UserProfile = upm.GetUserProfile(sAccount) u.CreatePersonalSite()
Dim mysite As SPSite = u.PersonalSite
Dim myurl As String = u.PersonalUrl
End Sub 'CreatePersonalSiteSample

public void UserProfileSample() 
{ 
// Get SPSite and service context from string 
strUrl = "http://SampleName"; 
SPSite site = new SPSite(strUrl); 
SPServiceContext serviceContext = SPServiceContext.GetContext(site); 
// Initialize user profile config manager object 
UserProfileManager upm = new UserProfileManager(serviceContext); 
//Create user sample string sAccount = "mydomain\\myalias"; 
if (!upm.UserExists(sAccount)) upm.CreateUserProfile(sAccount);  
//To set prop values on user profile 
UserProfile u = upm.GetUserProfile(sAccount); 
string sPropName = "PreferredName"; 
u[sPropName] = sAccount; 
u.Commit();  
//remove user profile sample 
upm.RemoveUserProfile(sAccount); }  
public void CreatePersonalSiteSample() { 
// Get SPSite and service context from string 
strUrl = "http://SampleName"; 
SPSite site = new SPSite(strUrl); 
SPServiceContext serviceContext = SPServiceContext.GetContext(site); 
// Initialize user profile config manager object 
UserProfileManager upm = new UserProfileManager(serviceContext); 
string sAccount = "mydomain\\myalias"; 
UserProfile u = upm.GetUserProfile(sAccount); 
u.CreatePersonalSite(); 
SPSite mysite = u.PersonalSite; 
string myurl = u.PersonalUrl; }

Remarks

The Commit() method must be called whenever a property of this class is changed or all changes will be lost.

Properties

AccountName AccountName AccountName

Gets the account name of the user profile.

Colleagues Colleagues Colleagues

Gets a ColleagueManager object that enables you to access and modify this user's colleagues.

CurrentChangeToken CurrentChangeToken CurrentChangeToken

Gets the current UserProfileChangeToken object for the change logs of this profile's ProfileType.

(Inherited from ProfileBase)
DisplayName DisplayName DisplayName

Gets or sets the value that represents the display name of this user profile.

EmailOptin EmailOptin EmailOptin

Gets the user's setting for the Email Notifications property.

FeedIdentifier FeedIdentifier FeedIdentifier

Gets the user's setting for the Feed service provider defined identifier property.

FollowedContent FollowedContent FollowedContent

Gets the manager object that enables you to access and modify this user's followed content.

ID ID ID

Gets the GUID for this profile.

(Inherited from ProfileBase)
Item[String] Item[String] Item[String]

Gets the value of the specified property.

Memberships Memberships Memberships

Gets a MembershipManager object that enables you to access and modify this user's group memberships.

MultiloginAccounts MultiloginAccounts MultiloginAccounts

Gets an array of string objects that represent the accounts that are secondary to the master account.

O15FirstRunExperience O15FirstRunExperience O15FirstRunExperience
Parent Parent Parent
PersonalizationLinks PersonalizationLinks PersonalizationLinks

Gets a PersonalizationLinkManager object that enables you to access and modify this user's personalization links.

PersonalSite PersonalSite PersonalSite

Gets the personal site of the user.

PersonalSiteCapabilities PersonalSiteCapabilities PersonalSiteCapabilities

Gets projected capabilities for the user’s personal site.

PersonalSiteInstantiationState PersonalSiteInstantiationState PersonalSiteInstantiationState

Gets an instantiation of the state of the personal site.

PersonalUrl PersonalUrl PersonalUrl

Gets the user’s personal URL.

PictureImportEnabled PictureImportEnabled PictureImportEnabled

Gets a Boolean value that indicates whether the user's picture is enabled for import from Exchange.

ProfileManager ProfileManager ProfileManager

Gets the UserProfileManager object for this user profile.

ProfileManagerBase ProfileManagerBase ProfileManagerBase

Gets the manager associated with this profile object.

ProfileSubtype ProfileSubtype ProfileSubtype

Gets or sets the profile subtype for this property.

(Inherited from ProfileBase)
ProfileSubtypeId ProfileSubtypeId ProfileSubtypeId

Gets or sets the profile subtype ID.

(Inherited from ProfileBase)
ProfileType ProfileType ProfileType

Gets the profile type for the profile.

Properties Properties Properties

Gets the ProfileSubtypePropertyManager object for this profile.

(Inherited from ProfileBase)
PublicOrganizationViewUrl PublicOrganizationViewUrl PublicOrganizationViewUrl

Gets the URL of the organization view page for this profile.

(Inherited from ProfileBase)
PublicUrl PublicUrl PublicUrl

Gets the URL of the public profile page for this profile.

QuickLinks QuickLinks QuickLinks

Gets the QuickLinkManager object for this user profile.

RecordId RecordId RecordId

Gets the profile's record identifier.

(Inherited from ProfileBase)
RemotePersonalSiteHostUrl RemotePersonalSiteHostUrl RemotePersonalSiteHostUrl

Gets the absolute URL string for the user's remote personal site host, if one exists.

StatusNote StatusNote StatusNote
Suggestions Suggestions Suggestions

Returns a SuggestionManager object that enables you to create and retrieve this user’s colleague and keyword suggestions.

UrlToCreatePersonalSite UrlToCreatePersonalSite UrlToCreatePersonalSite

Gets the URL that is used to create the user's personal site.

ViewerRights ViewerRights ViewerRights

Returns a bitmask of the viewer's rights to see this profile's data.

(Inherited from ProfileBase)

Methods

Commit() Commit() Commit()

Commits changes made to the user profile to the user profile database.

CreatePersonalSite() CreatePersonalSite() CreatePersonalSite()

Creates a personal site for this user if a personal site does not already exist.

CreatePersonalSite(Int32) CreatePersonalSite(Int32) CreatePersonalSite(Int32)

Creates a personal site for this user if a personal site does not already exist.

CreatePersonalSiteEnque(Boolean) CreatePersonalSiteEnque(Boolean) CreatePersonalSiteEnque(Boolean)

Enqueues creating a personal site for this user, which can be used to share documents, web pages, and other files.

Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is identical to the current profile.

(Inherited from ProfileBase)
GetChanges() GetChanges() GetChanges()

Returns all changes made to this user's data.

GetChanges(ProfileBaseChangeQuery) GetChanges(ProfileBaseChangeQuery) GetChanges(ProfileBaseChangeQuery)

Returns changes to this user’s data that are defined by the specified change query.

GetChanges(UserProfileChangeToken) GetChanges(UserProfileChangeToken) GetChanges(UserProfileChangeToken)

Returns all changes made to this user's data since a given time specified by the change token.

GetColleagueChanges() GetColleagueChanges() GetColleagueChanges()

Returns all changes made to this user's colleagues' data.

GetColleagueChanges(UserProfileChangeQuery) GetColleagueChanges(UserProfileChangeQuery) GetColleagueChanges(UserProfileChangeQuery)

Returns all changes made to this user's colleagues' data that are defined by the specified change query.

GetColleagueChanges(UserProfileChangeToken) GetColleagueChanges(UserProfileChangeToken) GetColleagueChanges(UserProfileChangeToken)

Returns all changes made to this user's colleagues' data since the time specified by the change token.

GetCommonManager() GetCommonManager() GetCommonManager()
GetDirectReports() GetDirectReports() GetDirectReports()

Gets an array of user profiles that represent users who report directly to this user.

GetEnumerator() GetEnumerator() GetEnumerator()

Gets an enumerator for the properties of a user profile such as property name or property value pairs.

GetExtendedReports() GetExtendedReports() GetExtendedReports()

Gets an array of user profiles representing users who are extended reports of this user.

GetHashCode() GetHashCode() GetHashCode()

Returns the hash code for the unique identifier of this profile.

(Inherited from ProfileBase)
GetManager() GetManager() GetManager()

Gets the user profile that represents this user’s manager.

GetManagers() GetManagers() GetManagers()

Gets an array of user profiles that represents the manager hierarchy for this user.

GetMyDirectReportOrganizations() GetMyDirectReportOrganizations() GetMyDirectReportOrganizations()

Returns an array of organization profiles representing organizations that report to this user.

GetMyOrganizationChains() GetMyOrganizationChains() GetMyOrganizationChains()

Returns an array of organization profiles, including child organizations.

GetMyOrganizations() GetMyOrganizations() GetMyOrganizations()

Returns an array of organization profiles representing organizations to which this user directly belongs.

GetMyOrganizations(Boolean) GetMyOrganizations(Boolean) GetMyOrganizations(Boolean)

Returns an array of organization profiles representing organizations to which this user directly belongs.

GetPeers() GetPeers() GetPeers()

Gets an array of user profiles that represent users who report to the same manager as this user.

GetProfileValueCollection(String) GetProfileValueCollection(String) GetProfileValueCollection(String)

Returns a list of values for the user profile property with the specified name.

GetViewerRights() GetViewerRights() GetViewerRights()
IsProfileOwner(UserProfile) IsProfileOwner(UserProfile) IsProfileOwner(UserProfile)

Returns a value that indicates whether the specified user is an owner of this user profile.

RefreshManagers() RefreshManagers() RefreshManagers()

Updates the names of managers identified in the user’s profile.

ShareAllSocialData(Boolean) ShareAllSocialData(Boolean) ShareAllSocialData(Boolean)

Sets the privacy settings for this profile.

SID() SID() SID()

Gets the profile's unique identifier.

(Inherited from ProfileBase)

Extension Methods

ToJson(Object) ToJson(Object) ToJson(Object)

Applies to