I want to add values to a lookupmulti field with c#. the form shows the field correctly but my code just won't work:
SPList list = SPContext.Current.Web.Lists["testlist"];
SPListItem item = list.GetItemById(someId);
SPFieldLookupValueCollection fieldValues = new SPFieldLookupValueCollection();
foreach(int id in itemIds) {
fieldValues.Add(new SPFieldLookupValue {LookupId = id});
}
item["lookupmultifield"] = fieldValues;
The code above is not exactly my code, but it's how i thought it should work. FieldValues has 2 entries, but only the first is inserted in the lookupmulti field. can anyone help?