I have one requirement in which I have to display the saved users to the share point people editor control. For this I am saving the user names to People/Group column. And i am using the following code for taking theis user to people editor control.
SetPeopleEditor(item, Constants.FieldNames.IT_DIRECTOR, pe_ITDirector, oWeb);
The definition of the aboe method is shown below.
private PickerEntity SetPeopleEditor(SPListItem item, string columnName, PeopleEditor peopleEditor, SPWeb web)
{
ArrayList entityArrayList = new ArrayList();
PickerEntity entity = null;
if (item[columnName] != null)
{
char[] to_splitter = { ';' };
string to_list = item[columnName].ToString(); // Reads value stored in SPList. (i.e., "Domain\User1; Domain\User2")
string[] arr = to_list.Split(to_splitter);
string user = string.Empty;
for (int i = 1; i < arr.Length; i++)
{
if ((i % 2) != 0)
{
user = arr[i].Substring(arr[i].IndexOf("#") + 1);
entity = new PickerEntity();
entity.Key = user;
entity.IsResolved = true;
entity = peopleEditor.ValidateEntity(entity);
entityArrayList.Add(entity);
}
}
}
return entity;
}
But unfortunately the control always showing empty value. How can I achieve this by populating data to the people editor control