Using SharePoint SOAP with jQuery GetListItems - Simple but can't work it out!

前端 未结 2 1705
情歌与酒
情歌与酒 2021-01-14 17:03

I\'m trying to load in a SharePoint list to a Unordered List so I can create a simple search function (the Sharepoint Search is just horrible). The code I have borrowed and

相关标签:
2条回答
  • 2021-01-14 17:22

    Have you verified you're referencing the correct Field names?

    The CAML query you've defined in soapEnv requires the use of the fields' internal names, not their display names. I guarantee Metric Name is not right; it's probably something like Metric_x0020_Name or similar.

    How do you determine the internal names of your fields? There's a couple of methods.

    Let me introduce you to a great utility called U2U CAML Query Builder. This should be in every SharePoint developer's toolbox. Fire it up, point it at the right list (connect via SharePoint Web Service if you're not on the server), and it will allow you to build CAML queries using the display names of the fields, but generate the correct underlying CAML for you. It's also great for constructing complex filters and boolean logic, plus it lets you run the query and get immediate feedback.

    Another approach to getting the field name is to navigate into the list settings, then click on the name of a field you're interested in. Check out your URL and look for the querystring parameter named &Field; it will divulge the internal name of the field. This value will be URL Encoded if you're using Internet Explorer (a simple online decoder can help decipher the value), but if you use Firefox, you'll see the value unencoded.

    Plug the correct Field names into your CAML query and give it another whirl.

    0 讨论(0)
  • 2021-01-14 17:28

    On your Result function, add an alert(xData.responseXML.xml); to make sure you're getting the ows_ReportName attribute.

    Perhaps its name is spelled slightly differently (they're case-sensitive). Alternately, try ows_Title to see if it returns defined data. If so, you're getting the XML back, it just can't find ReportName as a valid column in the returned data.

    0 讨论(0)
提交回复
热议问题