UserProfileManager.GetStringSinglePropertyValueForUser Method
Retrieves the single-valued property for the UserProfile whose name matches the propertyName parameter of the UserProfile identified by the accountName parameter.
Namespace: Microsoft.Office.Server.UserProfiles
Assembly: Microsoft.Office.Server.UserProfiles (in Microsoft.Office.Server.UserProfiles.dll)
Syntax
'Declaration
Public Shared Function GetStringSinglePropertyValueForUser ( _
serviceContext As SPServiceContext, _
propertyName As String, _
accountName As String _
) As String
'Usage
Dim serviceContext As SPServiceContext
Dim propertyName As String
Dim accountName As String
Dim returnValue As String
returnValue = UserProfileManager.GetStringSinglePropertyValueForUser(serviceContext, _
propertyName, accountName)
public static string GetStringSinglePropertyValueForUser(
SPServiceContext serviceContext,
string propertyName,
string accountName
)
Parameters
serviceContext
Type: Microsoft.SharePoint.SPServiceContextThe set of UserProfile objects to search for the specified account name.
propertyName
Type: System.StringThe name of the UserProfile property to retrieve from the current UserProfile.
accountName
Type: System.StringThe account name of the requested user profile.
Return Value
Type: System.String
A string representing a single-valued property.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | serviceContext is a null reference (Nothing in Visual Basic). accountName is a null reference (Nothing in Visual Basic). |
InvalidOperationException | propertyName is a null reference (Nothing in Visual Basic) or an empty string. accountName is a null reference (Nothing in Visual Basic) or an empty string. |