Add the People picker field in the ascx file as below
<SharePoint:PeopleEditor runat="server" ID="peoplePickerID" MultiSelect="true"
SelectionSet="User" />
in the code behind on page load write the logic to fill teh people picker from a list having a
people/group type column.
ArrayList PickerEntities = new ArrayList();
SPFieldUserValueCollection fieldUserValueCollection = (SPFieldUserValueCollection)item["PeopleGroupTypeColumnDispName"];
foreach (SPFieldUserValue spuserval in fieldUserValueCollection)
{
SPUser userToassign = spuserval.User;
PickerEntity entity = new PickerEntity();
PeopleEditor pepEditor = new PeopleEditor();
entity.EntityData["AccountName"] = spuserval.User.LoginName;
entity.EntityData["SPUserID"] = spuserval.User.ID;
entity.EntityData["Email"] = spuserval.User.Email;
entity.Key = spuserval.User.LoginName;
entity.Description = spuserval.User.LoginName;
entity.DisplayText = spuserval.User.Name;
entity = pepEditor.ValidateEntity(entity);
entity.IsResolved = true;
PickerEntities.Add(entity);
}
peoplePickerID.UpdateEntities(PickerEntities);
*item["PeopleGroupTypeColumnDispName"];--> is list column of people/group type
Have a look at other post about client people picker of Sharepoint 2013
Client people picker-Sharepoint 2013
<SharePoint:PeopleEditor runat="server" ID="peoplePickerID" MultiSelect="true"
SelectionSet="User" />
in the code behind on page load write the logic to fill teh people picker from a list having a
people/group type column.
ArrayList PickerEntities = new ArrayList();
SPFieldUserValueCollection fieldUserValueCollection = (SPFieldUserValueCollection)item["PeopleGroupTypeColumnDispName"];
foreach (SPFieldUserValue spuserval in fieldUserValueCollection)
{
SPUser userToassign = spuserval.User;
PickerEntity entity = new PickerEntity();
PeopleEditor pepEditor = new PeopleEditor();
entity.EntityData["AccountName"] = spuserval.User.LoginName;
entity.EntityData["SPUserID"] = spuserval.User.ID;
entity.EntityData["Email"] = spuserval.User.Email;
entity.Key = spuserval.User.LoginName;
entity.Description = spuserval.User.LoginName;
entity.DisplayText = spuserval.User.Name;
entity = pepEditor.ValidateEntity(entity);
entity.IsResolved = true;
PickerEntities.Add(entity);
}
peoplePickerID.UpdateEntities(PickerEntities);
*item["PeopleGroupTypeColumnDispName"];--> is list column of people/group type
Have a look at other post about client people picker of Sharepoint 2013
Client people picker-Sharepoint 2013
No comments:
Post a Comment