Unable to update lookup Field using webservice RRS feed

  • Question

  • Hi,

    I have read many of the solutions but I haven't yet been able to populate a lookup column in a list using web service.

    I have a list of some application families named "ApplicationFamilyList" on the same site.

    In my current list I have a column named "Appfamily" of type lookup which has reference to "ApplicationFamilyList". I wish to insert some application families in that column using webservice - UpdateListItems() method. however, I am unable to populate items in this column maybe due to reference. below is the XML I am generating declaratively. Please suggest what attributes I need to add to <Field> tag to get the results.

    string strBatch = 	
    "<Method ID='1' Cmd='New'>
    <Field Type='Text' DisplayName='Application_Name' ID='{b475c14a-46ae-495f-b381-d264c2f51a45}'Name='Application_Name'>testApplication1</Field>
    <Field Type='Lookup' DisplayName='Application_Family' ID='{bbe858fd-0c8e-406b-a278-83cac0b58d1b}' Name='Application_Family'>testfamilyfamily1</Field>
    XmlDocument xmlDoc = new System.Xml.XmlDocument();
    System.Xml.XmlElement elItem = xmlDoc.CreateElement("Batch");
    elItem.SetAttribute("OnError", "Continue");
    elItem.InnerXml = strBatch.ToString();
    string ListName = "Dev Application Name Lookup";
    UpdateSPList.UpdateListItems(ListName, elItem);

    Thanks in advance!!

    Friday, June 16, 2017 7:19 AM

All replies