none
c# client object model code to update "multilookup" column in sharepoint 2013 RRS feed

  • Question

  • Hi everyone, I'm trying to set and update Multi lookup column field value in SharePoint 2013 using c# client object model. Any sample code will be helpful!

    Thanks!

    Wednesday, April 26, 2017 11:13 AM

All replies

  • Hi,

    Here is sample code for your reference:

    ClientContext ctx = new ClientContext(weburl); ctx.Credentials = new SharePointOnlineCredentials(userName, passWord); List list = ctx.Web.Lists.GetByTitle("ListTitle"); ListItem currentItem = list.GetItemById(1); FieldLookupValue[] lookupFieldValCollection = new FieldLookupValue[3];

    FieldLookupValue lookupFieldA = new FieldLookupValue(); lookupFieldA.LookupId = 2; lookupFieldValCollection.SetValue(lookupFieldA, 0); FieldLookupValue lookupFieldB = new FieldLookupValue(); lookupFieldB.LookupId = 4; lookupFieldValCollection.SetValue(lookupFieldB, 1); FieldLookupValue lookupFieldC = new FieldLookupValue(); lookupFieldC.LookupId = 6; lookupFieldValCollection.SetValue(lookupFieldC, 2); currentItem["MultiLookupValCol"] = lookupFieldValCollection; currentItem.Update(); ctx.ExecuteQuery();

    https://piyushksingh.com/2014/01/19/update-a-lookupmulti-column-value-in-sharepoint-using-client-object-model-c/

    You could post the issues if any.

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, April 27, 2017 2:27 AM