开发者

How to filter SharePoint List using CAML query?

开发者 https://www.devze.com 2023-01-25 06:36 出处:网络
I am doing S开发者_StackOverflowSRS to retrieve data from two SharePoint lists. One is the viewing part and the other is for the filtering part.

I am doing S开发者_StackOverflowSRS to retrieve data from two SharePoint lists. One is the viewing part and the other is for the filtering part. This is easily done on a SQLServer database Data Source, but how can it be achieved using SharePoint lists?

The following is my query: The @name is a report parameter retrieved from the other 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.


Jane, you have two options:

  1. SQL Server 2008 R2 comes with the Sharepoint List Connection type (see link for tutorial) where the connection is as easy as using an SQL data source.

  2. If you are unfortunate and don't have access to that connection type you can make use of Sharepoint Web Services (specifically thelists.asmx service) for your XML query. See this tutorial: SQL Reporting Services data from SharePoint lists.

0

精彩评论

暂无评论...
验证码 换一张
取 消