SP GetListItems WebService - InfoPath Dev
in

InfoPath Dev

SP GetListItems WebService

Last post 08-11-2006 06:41 AM by Matt Faus. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 08-10-2006 12:22 AM

    SP GetListItems WebService

    I have an InfoPath Form. I have this code (c#):

    public void IdNumber_OnAfterChange(DataDOMEvent e)
    {

    if (e.IsUndoRedo)
    { return;
    }
    if (e.Operation=="Delete")
    { return;
    }


    XmlDocument xmlDoc = new System.Xml.XmlDocument();
    XmlNode ndQuery = xmlDoc.CreateNode
    (XmlNodeType.Element,"Query","");
    XmlNode ndViewFields = xmlDoc.CreateNode (XmlNodeType.Element,"ViewFields","");
    XmlNode ndQueryOptions = xmlDoc.CreateNode(XmlNodeType.Element,"QueryOptions","");


    string str=e.NewValue.ToString();

    ndQueryOptions.InnerXml
    = "<IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>" +
    "<DateInUtc>TRUE</DateInUtc>";



    ndQuery.InnerXml="<Where><Eq><FieldRef Name='IdNumber'/><Value Type='Text'>"+str+"</Value></Eq></Where>";



    try
    {
    XmlNode returnXml = WS.GetListItems("FormsFolder",null,ndQuery,null,null,ndQueryOptions);
    }
    }
    This is the code. I get error that the field with this name not found!!
    That's mean that the field name "IdNumber" not fount in the SharePoint list.
    Why it not found it? I know that I nedd to replace the field name with somthing else. How to do it?
  • 08-10-2006 02:54 PM In reply to

    Re: SP GetListItems WebService

    Is there a namespace on the IdNumber field?
  • 08-11-2006 06:41 AM In reply to

    Re: SP GetListItems WebService

    Make sure that you're using the name that SharePoint uses. If you create a new column and then change the name of it later, SharePoint will still use the original name as it's "identifier". To get the name SharePoint uses, go to Modify Settings and Columns, click Edit Columns, and then click on the idNumber column. Now, look at the URL in the address bar and there should be a Name field in the query string at the end of the URL. This is what you want to use in the CAML.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.