Every article about how to do this is slightly different and can't seem to figure this out.

I have two lookup fields which are both present on my Listitem. I have reference to the list item here.

The lookup field values are exactly the same (they are different lists they points to). So if Human Resources Document Category has Test1 as this value, it also exists in the lookup list for the field HR Document Category.

What I want to do is through CSOM update the field so if Human Resources Document Category says Test1 I want to HR Document Category to show Test1 as well. enter image description here

foreach (var listitem in listItemCollection)
     //var boxedListItem = (SPListItem)listitem;
     context.Load(listitem, f=>f.DisplayName, f=>f.FieldValuesAsText);

     //get reference to lookup field value
     var humanResourceDocCategory = "Human_x0020_Resources_x0020_Document_x0020_Category";
     FieldLookupValue originalCategoryValue = listitem[humanResourceDocCategory] as FieldLookupValue;

     //get ref to HR Document Category
     var hrDocCategory = "HR_x0020_Document_x0020_Category";
     listitem[hrDocCategory] = originalCategoryValue.LookupId;
     //listitem.ParseAndSetFieldValue(hrDocCategory, originalCategoryValue.Id);



This doesn't seem to work. If I do sometrhing like listitem[hrDocCategory] = listitem[humanResourceDocCategory] then, it doesn't add the value!!

Please help.

1 Answer 1


It's according to what I understand,


You need same value in both Human Resources Document Category and HR Document Category columns. As both are lookup columns and both are pointing to different lists for that.

Possible solution:

  • If Human Resources Document Category has test1 value, then fetch that value (test1) by firing caml query in list which is pointed in HR Document Category column as a reference.
  • Get its id and assign it to listitem[hrDocCategory].

Hope this will help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.