I have a web part that submits data to a list and it uses a PeopleEditor control for selecting users.
Once user is selected, when I submit the form it gives following error
Invalid data has been used to update the list item. The field you are trying to update may be read only.
I have included tag prefix as
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
Control is inserted as
<SharePoint:PeopleEditor ID="a" runat="server" PrincipalSource="All" SharePointGroup="Everyone" MultiSelect="false" />
And on click of a submit button-
SPWeb web = SPContext.Current.Web;
SPListCollection vlist = web.Lists;
SPList list = web.Lists[new Guid("{xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}")];
SPListItem listitem = list.Items.Add();
listitem["FormCompletedBy"] = a.ResolvedEntities;
listitem.Update();
Where
FormCompletedBy
is a field in SharePoint List where the data is to be submitted.