简体   繁体   English

如何使用CAML查询过滤SharePoint列表?

[英]How to filter SharePoint List using CAML query?

I am doing SSRS to retrieve data from two SharePoint lists. 我正在使用SSRS从两个SharePoint列表中检索数据。 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? 这很容易在SQLServer数据库数据源上完成,但如何使用SharePoint列表实现?

The following is my query: The @name is a report parameter retrieved from the other list. 以下是我的查询:@name是从其他列表中检索的报表参数。

    <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. SQL Server 2008 R2附带了Sharepoint List Connection类型(请参阅教程链接) ,其中连接就像使用SQL数据源一样简单。

  2. If you are unfortunate and don't have access to that connection type you can make use of Sharepoint Web Services (specifically the lists.asmx service) for your XML query. 如果您不幸并且无法访问该连接类型,则可以使用Sharepoint Web Services(特别是lists.asmx服务)进行XML查询。 See this tutorial: SQL Reporting Services data from SharePoint lists . 请参阅本教程: SharePoint列表中的SQL Reporting Services数据

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM