private void SetPeopleInfo(SPListItem listItem)
{
SPFieldUserValueCollection values = new SPFieldUserValueCollection();
for (int i = 0; i < pplEditor.ResolvedEntities.Count; i++)
{
PickerEntity picker = (PickerEntity)pplEditor.ResolvedEntities[i];
SPFieldUserValue userValue = new SPFieldUserValue(GetWeb(),
Convert.ToInt32(picker.EntityData[PeopleEditorEntityDataKeys.UserId]),
picker.Description);
values.Add(userValue);
}
if (values.Count > 0)
{
listItem["__AssignedToName"] = values[0].User.Name;
listItem["__AssignedToEmail"] = values[0].User.Email;
listItem["__AssignedTo"] = values.ToString();
}
else
{
listItem["__AssignedToName"] = null;
listItem["__AssignedToEmail"] = null;
listItem["__AssignedTo"] = null;
}
}
|