If you try to assign directly like below then you will get an error with message saying "Invalid data has been used to update the list item. The field you are trying to update may be read only".
newItem["Resource_x0020_ID"] = "john@company.com";
Below is the correct way to assign value to a lookup column:
SPListItem newItem = list.AddItem();
newItem["Resource_x0020_ID"] = new SPFieldLookupValue(empID.ID, empID.Title);
newItem.Update();
No comments:
Post a Comment