I'm having trouble setting multi lookup field. I found this example:
Update a LookupMulti Column value in SharePoint using Client Object Model C# and
Setting a SharePoint Multi-value Lookup Field value using PowerShell and CSOM
And also this: Add values to lookupmulti field in c#, but its not using CSOM.
The code I have is this:
ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
SP.ListItem oListItem = oList.AddItem(itemCreateInfo);
FieldLookupValue[] arr = new FieldLookupValue[1];
FieldLookupValue lvItem = new FieldLookupValue();
lvItem.LookupId = 7;
arr[0] = lvItem;
oListItem["prjIBusers"] = arr;
oListItem.Update();
context.ExecuteQuery();
But it throws the following error at ExecuteQuery()
Microsoft.SharePoint.Client.ServerException
HResult=0x80131500
Message=Unknown Error
Source=Microsoft.SharePoint.Client.Runtime
StackTrace:
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)
at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()