none
programmatically setting custom column (with datatype person/group) of a sharepoint list.

    Question

  • 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

    Monday, June 18, 2012 7:44 AM

Answers

  • Hello,

    Have you tried this?

    SPUser userObj = SPContext.Current.Web.CurrentUser;
    
    item["Recruiter"]= userObj; 
    -Saumil

    • Marked as answer by VidyaPai Monday, June 18, 2012 8:59 AM
    Monday, June 18, 2012 8:25 AM

All replies