PeopleEditorEntityDataKeys Class
Represents keys that can be used as indexers against the PickerEntity.EntityDataHashTable object to expose picker information.
Namespace:
Microsoft.SharePoint.WebControls
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
PeopleEditorEntityDataKeys
Description
The Microsoft.SharePoint.WebControls.PeopleEditorEntityDataKeys represents a reusable module that helps surface conventional people information, heavily represented when exposing data from a Microsoft.SharePoint.WebControls.PickerEntity object. The class is significant since the Microsoft.SharePoint.WebControls.PeopleEditor+PeopleInfo structure is marked as internal. This limitation implies that the PeopleEditor+PeopleInfo structure is inaccessible externally due to its protection level. However, using PeopleEditorEntityDataKeys allows the PickerEntity.EntityDataHashTable to be indexed against without reverting to utilization of string literals.
There are 7 fields that are exposed by the PeopleEditorEntityDataKeys class:
PeopleEditorEntityDataKeys.Department – Mapped to the PeopleEditor.PeopleInfo.Department property
PeopleEditorEntityDataKeys.DisplayName – Mapped to the PeopleEditor.PeopleInfo.DisplayName property
PeopleEditorEntityDataKeys.Email – Mapped to the PeopleEditor.PeopleInfo.Email property
PeopleEditorEntityDataKeys.PrincipalType – Mapped to the PeopleEditor.PeopleInfo.PrincipalType property
PeopleEditorEntityDataKeys.SharePointGroupId -- Mapped to the PeopleEditor.PeopleInfo.SPGroupId property
PeopleEditorEntityDataKeys.SIPAddress -- Mapped to the PeopleEditor.PeopleInfo.SIPAddress property
PeopleEditorEntityDataKeys.UserId – Mapped to the PeopleEditor.PeopleInfo.SPUserId property
The Usage Scenario
The primary usage of the PeopleEditorEntityDataKeys class is as an indexer against the PickerEntity.EntityDataHashTable to expose diverse picker information, often for the manufacture of new objects.
In the below, I am demonstrating having global PeopleEditor object, and how the PeopleEditor.ResolvedEntitiesArrayList can be used in order to construct new SPUserInfo objects. Specifically, the SPUserInfo.Name property is being set by leveraging PeopleEditorEntityDataKeys.DisplayName.
C# Code Example
private PeopleEditor peopleEditor;
private SPUserInfo ReturnUserInfo()
{
ArrayList resolvedEntities = peopleEditor.ResolvedEntities;
var entity = (PickerEntity)resolvedEntities[0];
var info = new SPUserInfo
{
LoginName = entity.Key,
Name = ((string)entity.EntityData[PeopleEditorEntityDataKeys.DisplayName])
};
return info;
}
Visual Basic .NET Code Example
Private peopleEditor As PeopleEditor
Private Function ReturnUserInfo() As SPUserInfo
Dim resolvedEntities As ArrayList = peopleEditor.ResolvedEntities
Dim entity As var = DirectCast(resolvedEntities(0), PickerEntity)
Dim info As var
LoginName = entity.Key
End Function
Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com
The Microsoft.SharePoint.WebControls.PeopleEditorEntityDataKeys represents a reusable module that helps surface conventional people information, heavily represented when exposing data from a Microsoft.SharePoint.WebControls.PickerEntity object. The class is significant since the Microsoft.SharePoint.WebControls.PeopleEditor+PeopleInfo structure is marked as internal. This limitation implies that the PeopleEditor+PeopleInfo structure is inaccessible externally due to its protection level. However, using PeopleEditorEntityDataKeys allows the PickerEntity.EntityDataHashTable to be indexed against without reverting to utilization of string literals.
There are 7 fields that are exposed by the PeopleEditorEntityDataKeys class:
PeopleEditorEntityDataKeys.Department – Mapped to the PeopleEditor.PeopleInfo.Department property
PeopleEditorEntityDataKeys.DisplayName – Mapped to the PeopleEditor.PeopleInfo.DisplayName property
PeopleEditorEntityDataKeys.Email – Mapped to the PeopleEditor.PeopleInfo.Email property
PeopleEditorEntityDataKeys.PrincipalType – Mapped to the PeopleEditor.PeopleInfo.PrincipalType property
PeopleEditorEntityDataKeys.SharePointGroupId -- Mapped to the PeopleEditor.PeopleInfo.SPGroupId property
PeopleEditorEntityDataKeys.SIPAddress -- Mapped to the PeopleEditor.PeopleInfo.SIPAddress property
PeopleEditorEntityDataKeys.UserId – Mapped to the PeopleEditor.PeopleInfo.SPUserId property
The Usage Scenario
The primary usage of the PeopleEditorEntityDataKeys class is as an indexer against the PickerEntity.EntityDataHashTable to expose diverse picker information, often for the manufacture of new objects.
In the below, I am demonstrating having global PeopleEditor object, and how the PeopleEditor.ResolvedEntitiesArrayList can be used in order to construct new SPUserInfo objects. Specifically, the SPUserInfo.Name property is being set by leveraging PeopleEditorEntityDataKeys.DisplayName.
C# Code Example
private PeopleEditor peopleEditor;
private SPUserInfo ReturnUserInfo()
{
ArrayList resolvedEntities = peopleEditor.ResolvedEntities;
var entity = (PickerEntity)resolvedEntities[0];
var info = new SPUserInfo
{
LoginName = entity.Key,
Name = ((string)entity.EntityData[PeopleEditorEntityDataKeys.DisplayName])
};
return info;
}
Visual Basic .NET Code Example
Private peopleEditor As PeopleEditor
Private Function ReturnUserInfo() As SPUserInfo
Dim resolvedEntities As ArrayList = peopleEditor.ResolvedEntities
Dim entity As var = DirectCast(resolvedEntities(0), PickerEntity)
Dim info As var
LoginName = entity.Key
End Function
Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com
- 6/3/2010
- Adam Buenz - MVP