programmatically setting custom column (with datatype person/group) of a sharepoint list.
-
lundi 18 juin 2012 07:44
Hi,
I have a custom list with one of the column as "Recruiter"(of which the datatype is person/group). I am adding list item programmatically as
string struser = SPContext.Current.Web.CurrentUser.Name;
item["Recruiter"]= struser ;
item.update();
then it thoughs the error as
Invalid data has been used to update the list item. The field you are trying to update may be read only.
Please help me to resolve this if anyone knows this.
Thanks in advance
Toutes les réponses
-
lundi 18 juin 2012 08:25
Hello,
Have you tried this?
SPUser userObj = SPContext.Current.Web.CurrentUser; item["Recruiter"]= userObj;
-Saumil
- Marqué comme réponse VidyaPai lundi 18 juin 2012 08:59
-
lundi 18 juin 2012 08:25
Hi,
Try this:
string struser = SPContext.Current.Web.CurrentUser;
item["Recruiter"]= struser ;
item.update();
Notice that I removed Name property from first line.
Regards!
José Quinto Zamora
SharePoint and Search Specialist at SolidQ(http://www.solidq.com)
MCITP and MCPD in SharePoint 2010
http://blogs.solidq.com/sharepoint -
lundi 18 juin 2012 09:02
Hi Saumil,
Its working for
SPUser userObj = SPContext.Current.Web.CurrentUser;
Thanks.

