Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a CSOM console app that uploads files to a library, then it creates a lookup field in another list and also adds lookups to the files in my library.

The following code adds a single item in the lookup:

FieldLookupValue flv = new FieldLookupValue() { LookupId = Convert.ToInt32(attachmentFile.Id) };
listItem["MyAttachments"] = flv;

How can i modify this to add multiple FieldLookupValue's?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Try the following:

Create a List of FieldLookupValue's

List<FieldLookupValue> lookupValues = new List<FieldLookupValue>();

Add a new FieldLookupValue for each file id

lookupValues.Add(new FieldLookupValue() { LookupId = Convert.ToInt32(attachmentFile.Id) });

When finished set the listItem to the List

listItem["MyAttachments"] = lookupValues;

Hope this works for you!

share|improve this answer
Hi Tom, thanks so much for the assistance. That worked perfectly for me. So simple. Im embarassed i didnt see that solution myself. – Cobus de Witt Jun 26 '13 at 6:50

You can declare Property like below

public ICollection<FieldLookupValue> Brand { get; set; }

Below you can get set the Property :

ICollection<FieldLookupValue> ICustomerRequirementView.Brand
                //return it here`enter code here`
                //set it here
                //new List<FieldLookupValue> { new FieldLookupValue() { LookupId = 1 } }

//below u can set the value in ListItemCreationInformation object

ListItemCreationInformation listObj = new ListItemCreationInformation();
                ListItem item = ctx.Web.Lists.GetByTitle("CustomerRequirement").AddItem(listObj);
                item["Brand"] = customerRequirement.Brand;
share|improve this answer
Would you please explain your answer, How it can be used to solve the problem. It will be very useful for the readers. – Asad Refai Sep 22 at 5:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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