How to filter a SharePoint list using a CAML query?

I am doing SSRS to retrieve data from two SharePoint lists. One of them is the viewing part, and the other is for the filtering part. This is easy to do in the SQLServer Data Source database, but how can this be done using SharePoint lists?

Below is my query: @name is a report parameter obtained from another list.

    <Query>
<Method Namespace="http://schemas.microsoft.com/sharepoint/soap/" Name="GetListItems">
        <Parameters>
            <Parameter Name="listName">
                <DefaultValue>{D5D33A07-D1CA-440F-8A6B-912B9CE5BB2F}</DefaultValue>
            </Parameter>
            <Parameter Name="rowLimit">
                <DefaultValue>9999</DefaultValue>
            </Parameter>
            <Parameter Name="viewName">
                <DefaultValue>{F5459664-7C2F-4618-81FC-F2275FB2FBCF}</DefaultValue>
            </Parameter>
        </Parameters>
</Method>
<Where>
     <Eq>
         <FieldRef Name='ows_Firstname' />
         <Value Type='Text'>@name</Value>
     </Eq>
</Where>
    <ElementPath IgnoreNamespaces="true">GetListItemsResponse/GetListItemsResult/listitems/data/row{@ows_EmployeeID,@ows_Firstname,@ows_Lastname,@ows_Department}</ElementPath> 
<SoapAction>http://schemas.microsoft.com/sharepoint/soap/GetListItems</SoapAction>
</Query>

Please, help.

+3
source share
2 answers

Jane, you have two options:

+1

Source: https://habr.com/ru/post/1775385/


All Articles