I have list A with "Title" column which is lookup column to List B. I need to update existing List B documents so that they will be linked to List A. However, SharePoint client context doesn't accept extra argument in FieldLookupValue().

I thought I could code like:

ListItem i; // handle of List B item
var _newLookupField = new SP.FieldLookupValue();
_newLookupField.LookupId = 1;
_newLookupField.LookupValue = "Project A";
i["Project"] = _newLookupField; // Project is lookup column in List B


But this doesn't work in Client model. Any help is must appreciated.

2 Answers 2


In order to set a lookup field using CSOM, the ID of the item from the lookup list should be specified. This ID can then be used to set the listitem's FieldLookupValue.

 FieldLookupValue lv = new FieldLookupValue();
 lv.LookupId = 1;
 item["Project"] = lv;

Below is provided the complete example for specifying a lookup field using CSOM

public static void SetListItemLookupValue()
            ClientContext clientContext = new ClientContext("http://intranet.contoso.com/");
            List list = clientContext.Web.Lists.GetByTitle("Docs");
            FieldCollection fields = list.Fields;
            CamlQuery camlQueryForItem = new CamlQuery();
            camlQueryForItem.ViewXml = @"<View>
                                                <FieldRef Name='ID'/>
                                                <Value Type='Counter'>4</Value>
            ListItemCollection listItems = list.GetItems(camlQueryForItem);
            clientContext.Load(listItems, items => items.Include
                                            (listItem => listItem["Project"],
                                             listItem => listItem["Editor"],
                                             listItem => listItem["Title"]));
            ListItem item = listItems[0];

            FieldLookupValue lv = item["Project"] as FieldLookupValue;
            if(lv == null) lv = new FieldLookupValue();
            lv.LookupId = 1;
            item["Project"] = lv;
  • 1
    Worked like a charm! Thank you :)
    – ZooZ
    Commented May 14, 2019 at 11:36

Try this method. Here I am assuming that i is an item from the list.

var _newLookupField = new SP.FieldLookupValue();
var newId = 1;

i.set_item("Project", _newLookupField);

EDIT: Ok, I just looked at your code and realized that might be C# but I automatically assumed it was JavaScript. Is this question MANAGED Client Object Model?

  • Yes Its C# managed client object model.
    – Rishi
    Commented Jul 22, 2013 at 18:59

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.