Share via


UserProfile.Item Property

Contains a specified property value.

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

Syntax

'Declaration
Public ReadOnly Default Property Item ( _
    strPropName As String _
) As UserProfileValueCollection
    Get
'Usage
Dim instance As UserProfile
Dim strPropName As String
Dim value As UserProfileValueCollection

value = instance(strPropName)
public UserProfileValueCollection this[
    string strPropName
] { get; }

Parameters

Property Value

Type: Microsoft.Office.Server.UserProfiles.UserProfileValueCollection
Object that contains the specified property value.
The Item property returns the value in the data type specified in the profile property schema PropertyCollection. When setting a property value, it is expected to be either the correct data type or a string that can be parsed to the correct data type. When passing a string, all properties must be formatted using the portal site's culture settings except for dates, which must be formatted using the invariant culture.

Remarks

If the property is a unique identifier property and if this property is imported from Active Directory directory service, the return object could be Byte[] instead of Sytem.GUID.

Examples

The following code example shows how to retrieve the unique identifier property:

UserProfileManager upm = new UserProfileManager(); 
UserProfile user = upm.GetUserProfile("domain\user"); System.Guid guidAUserProperty = GetGUIDProperty(user["AGuidProperty"]);  System.Guid GetGUIDProperty(object objPropValue) {    if (objPropValue is System.Guid)          return (Guid) objPropValue;    else if (objPropValue is byte[])          return new Guid((byte[]) objPropValue);    else throw new ArgumentException("...");     return Guid.Empty; }

See Also

Reference

UserProfile Class

UserProfile Members

Microsoft.Office.Server.UserProfiles Namespace