1

I'm making an Ajax call to the Lists web service to retrieve some items. I'd like to return results only from a specific view. Can I do that through CAML?

I have this so far - which the attribute 'listView' is not correct. Is there a way to include the List View Name in the query?:

<GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
    <listName>Entertainment Guides</listName>
    <listView>Max Spending Rates</listView>
    <viewFields>
        <ViewFields>
            <FieldRef Name="Title"></FieldRef>
            <FieldRef Name="What_x0020_to_x0020_Know"></FieldRef>
        </ViewFields>
    </viewFields>
</GetListItems>
2

After a quick look at the code, I realized two problems:

  1. The name I was using to refer to the view was incorrect, so I've switched to the GUID
  2. The attribute should be called 'viewName' instead of 'listView'

So, the working code is this:

<GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
    <listName>Entertainment Guides</listName>
    <viewName>{7DEBCA83-9228-4E2F-B7CB-C94C54DF170D}</viewName>
    <viewFields>
        <ViewFields>
            <FieldRef Name="Title"></FieldRef>
            <FieldRef Name="What_x0020_to_x0020_Know"></FieldRef>
        </ViewFields>
    </viewFields>
</GetListItems>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.