Dear All,
If you want to include the people picker in your SharePoint web part custom web part below is the single line you can add in it.
ASPX Code:
<SharePoint:ClientPeoplePicker Required="true" ValidationEnabled="true" ID="spPeoplePicker" runat="server" VisibleSuggestions="3" Rows="1" AllowMultipleEntities="true" CssClass="ms-long ms-spellcheck-true" Height="85px" />
Code Behind:
If you want to include the people picker in your SharePoint web part custom web part below is the single line you can add in it.
ASPX Code:
<SharePoint:ClientPeoplePicker Required="true" ValidationEnabled="true" ID="spPeoplePicker" runat="server" VisibleSuggestions="3" Rows="1" AllowMultipleEntities="true" CssClass="ms-long ms-spellcheck-true" Height="85px" />
Code Behind:
PickerEntity picker = (PickerEntity)spPeoplePicker.ResolvedEntities[0];
SPUser user = web.EnsureUser(picker.Key);
SPFieldUserValue fieldvalue = new SPFieldUserValue(web, user.ID, user.LoginName);
item["User"] = fieldvalue;
item.Update();
Regards
3art Technology Experts
Comments
Post a Comment