Thursday, June 10, 2010

SharePoint Reports Query string in the xml soap format

For generating reports from SharePoint Lists, Query String is required.

I have mentioned some query string that fetch data from SharePoint .

1. Get All Data from SharePoint List
<Query> <Method Namespace="http://schemas.microsoft.com/sharepoint/soap/" Name="GetListItems">
<Parameters>
<Parameter Name="listName">
<DefaultValue>{List GUID}</DefaultValue>
</Parameter>
</Parameters>
</Method>
<SoapAction>http://schemas.microsoft.com/sharepoint/soap/GetListItems</SoapAction>
</Query>
 2. Get List Items Ordered by Date
 <Query>
<Method Namespace="http://schemas.microsoft.com/sharepoint/soap/" Name="GetListItems">
<Parameters>
<Parameter Name="listName">
<DefaultValue>{List GUID}</DefaultValue>
</Parameter>
<OrderBy><FieldRef name="ows_Date" /></OrderBy>
</Parameters>
</Method>
<SoapAction>http://schemas.microsoft.com/sharepoint/soap/GetListItems</SoapAction>
</Query>
 3. Get List Item from Title (Filtered Data)
<Query>
<SoapAction>http://schemas.microsoft.com/sharepoint/soap/GetListItems</SoapAction>
<Method Namespace="http://schemas.microsoft.com/sharepoint/soap/" xmlns="http://schemas.microsoft.com/sharepoint/soap/" Name="GetListItems">
<Parameters>
<Parameter Name="listName">
<DefaultValue>Contacts</DefaultValue>
</Parameter>
<Parameter Name="query" Type="xml">
<DefaultValue>
<Query>
<Where>
<Eq>
<FieldRef Name ="Title"/>
<Value Type="Text">-</Value>
</Eq>
</Where>
</Query>
</DefaultValue>
</Parameter>
<Parameter Name="rowLimit">
<DefaultValue> 9 </DefaultValue>
</Parameter>
</Parameters>
</Method>
<ElementPath IgnoreNamespaces="true"> GetListItemsResponse/GetListItemsResult/listitems/data/row{@ows_ID,@ows_Title} </ElementPath>
</Query>
 4.Get List Item from Item ID (Filtered Data)
<Query>
<SoapAction>http://schemas.microsoft.com/sharepoint/soap/GetListItems</SoapAction>
<Method Namespace="http://schemas.microsoft.com/sharepoint/soap/" xmlns="http://schemas.microsoft.com/sharepoint/soap/" Name="GetListItems">
<Parameters>
<Parameter Name="listName">
<DefaultValue>TicTacToe</DefaultValue>
</Parameter>
<Parameter Name="query" Type="xml">
<DefaultValue>
<Query>
<Where>
<Eq>
<FieldRef Name ="ID"/>
<Value Type="Integer">1</Value>
</Eq>
</Where>
</Query>
</DefaultValue>
</Parameter>
<Parameter Name="rowLimit">
<DefaultValue> 9 </DefaultValue>
</Parameter>
</Parameters>
</Method>
<ElementPath IgnoreNamespaces="true"> GetListItemsResponse/GetListItemsResult/listitems/data/row{@ows_ID,@ows_Title} </ElementPath>
</Query>

No comments:

Post a Comment