Wednesday, May 20, 2009

How to get all the values of PeopleEditor in Sharepoint

If we need to acess oll the values in the PeopleEditor control, we can iterate through the entities present in PeopleEditor:

Suppose we have a PeopleEditor control PE1 so the code will be :

ArrayList entities = PE1.ResolvedEntities;
foreach (object entity in entities)
PickerEntity pickerEntity = (PickerEntity)entity;
string accountName = pickerEntity.Key;
string displayName = pickerEntity.DisplayText;
// pickerEntity.EntityDate[] has other values like first name, last name, etc you might be interested in.

No comments: