0

I have a lookup column in a sharepoint 2013. I am trying to set value to that using FieldLookupValue from my asp.net ClientContext. It is throwing exception on clientContext.ExecuteQuery(). However the record gets inserted in the list. I also tried to add same column into different list and is able to insert record without any exception. Below is the code snippet.

    ClientContext clientContext = new ClientContext("http://MySite/MyWeb");
    private const string ETicket = "ServiceTicket";

    var itemCreationInfo = new ListItemCreationInformation();
    var list = clientContext.Web.Lists.GetByTitle(ETicket);
    SP.ListItem ticketItem = list.AddItem(itemCreationInfo);

    ticketItem["Title"] = "1";

    var lookup = new FieldLookupValue();
    lookup.LookupId = Convert.ToInt32(32);

    ticketItem["Category"] = lookup;       

    ticketItem.Update();
    clientContext.ExecuteQuery();
gee'K'iran
  • 431
  • 2
  • 7
  • 21

0 Answers0