I am trying to build an SSRS (2008R2) report based on a Sharepoint (2010) List.
The main problem is that the List on which the report will run has to be a report parameter.I know what the list structure will be, but the sharepoint site can contain several list instances having this structure, and when running the report, the user has to choose the List Name.
Also, the report has two date parameters, MinDateTime and MaxDateTime, and selects only the records with times between these two.
From what I can tell, there are at least two approaches to building the report:
Use a Sharepoint List Data Source and write the Dataset query in CAML, specify the site in the DataSource, let SSRS handle the rest of the details. The problem in this case is that I can't specify the ListName as a report parameter. The DataSet query looks like this:
<pre>
<RSSharePointList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ListName>BusinessList1</ListName>
<ViewFields>
<FieldRef Name="Title" />
<FieldRef Name="BusinessUnit" />
<FieldRef Name="ScanDateTime" />
</ViewFields>
<Query>
<Where>
<And>
<Geq>
<FieldRef Name="ScanDateTime" />
<Value Type="DateTime">
<Parameter Name="MinScanDateTime" />
</Value>
</Geq>
<Leq>
<FieldRef Name="ScanDateTime" />
<Value Type="DateTime">
<Parameter Name="MaxScanDateTime" />
</Value>
</Leq>
</And>
</Where>
</Query>
</RSSharePointList>
Use an XML Data Source and write the Dataset query in soap-readable XML, access the /_vti_bin/lists.asmx webservice directly. The query should look something like this (including the list name as a parameter). However, I couldn't make it work at all with the Date parameters. Where should they be added?
<pre>
<Query>
<SoapAction>http://schemas.microsoft.com/sharepoint/soap/GetListItems</SoapAction>
<Method Namespace="http://schemas.microsoft.com/sharepoint/soap/" Name="GetListItems">
<Parameters>
<Parameter Name="listName">
<DefaultValue>BusinessList1</DefaultValue>
</Parameter>
<Parameter Name="viewFields">
<ViewFields>
<FieldRef Name="Title" />
<FieldRef Name="BusinessUnit" />
<FieldRef Name="ScanDateTime" />
</ViewFields>
</Parameter>
</Parameters>
</Method>
<ElementPath IgnoreNamespaces="True">*</ElementPath>
</Query>
Any direction would be great.
Thanks,
You can use option 1, writing the query as an expression. Build up a long string with the parameter in the middle. You need a separate query to supply the list of BusinessLists to the parameter.
Expression would look like this:
="<pre>
<RSSharePointList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ListName>"
& Parameters!BusinessList.value &
"</ListName>
<ViewFields>
<FieldRef Name="Title" />
<FieldRef Name="BusinessUnit" />
<FieldRef Name="ScanDateTime" />
</ViewFields>
<Query>
<Where>
<And>
<Geq>
<FieldRef Name="ScanDateTime" />
<Value Type="DateTime">
<Parameter Name="MinScanDateTime" />
</Value>
</Geq>
<Leq>
<FieldRef Name="ScanDateTime" />
<Value Type="DateTime">
<Parameter Name="MaxScanDateTime" />
</Value>
</Leq>
</And>
</Where>
</Query>
</RSSharePointList>"
[EDIT]:
I'm not sure where the pre tag came from either. I've run through creating a test report using the sharepoint list connection type and it doesn't add that. Check out this MS link on the basics.
It points out that you don't need to specify the fields to return, so a very basic query expression looks like this (with my stuffed parameter added):
="<RSSharePointList xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""><ListName>" & Parameters!List.Value & "</ListName></RSSharePointList>"
In my original example above I failed to mention that you need to escape the double quotes within the XML by doubling them up. I've tested this and it works well.
Related
Note: This question is similar to an existing, unanswered question (CAML OrderBy for SharePoint Recurring Calendar Event).
How can I use the Lists.asmx web service to retrieve recurring events that occur today or later?
I am providing the <CalendarDate>2019-06-25T15:55:04.108Z</CalendarDate> parameter when sending the request to the /_vti_bin/Lists.asmx web service, yet I'm still receiving events from the past (as shown in the screenshot below)!
This is the XML response (screenshot). Notice how the event dates are before today even though "CalendarDate" is specified as "2019-06-25":
This is the XML payload sent with the request:
<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>
<soap:Body>
<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>
<listName>{ my list GUID }</listName>
<query>
<Query>
<OrderBy>
<FieldRef Ascending='TRUE' Name='EventDate' />
</OrderBy>
<Where>
<And>
<Eq>
<FieldRef Name="fRecurrence" />
<Value Type="Boolean">1</Value>
</Eq>
<DateRangesOverlap>
<FieldRef Name="EventDate" />
<FieldRef Name="EndDate" />
<FieldRef Name="RecurrenceID" />
<Value Type='DateTime'>
<Year/>
</Value>
</DateRangesOverlap>
</And>
</Where>
</Query>
</query>
<viewFields>
<ViewFields>
<FieldRef Name="Category" />
<FieldRef Name="Location" />
</ViewFields>
</viewFields>
<queryOptions>
<QueryOptions>
<ViewAttributes Scope="RecursiveAll" />
<RecurrencePatternXMLVersion>v3</RecurrencePatternXMLVersion>
<DateInUtc>TRUE</DateInUtc>
<ExpandRecurrence>TRUE</ExpandRecurrence>
<CalendarDate>2019-06-25T15:55:04.108Z</CalendarDate>
<RecurrenceOrderBy>TRUE</RecurrenceOrderBy>
</QueryOptions>
</queryOptions>
<rowLimit>20</rowLimit>
</GetListItems>
</soap:Body>
</soap:Envelope>
Edit: The following is an example of an event that is not being returned by the query above.
Year does not honour the CalendarDate property - it returns previous events that happened within a year from current date and future events a year from current date.
Use <Value Type='DateTime'><Now /></Value> in the DateRangesOverlap and remove the CalendarDate to retrieve recurring events that occur today or later
I am quite new in Sharepoint. I am working on sharepoint 2013. I have created a content type with Visual Studio.
I have written a query to sort the columns.
<OrderBy>
<FieldRef Name='Order' Ascending='True' />
<FieldRef Name='SortingOrder' Ascending='False' />
<FieldRef Name='IsFeatured1' Ascending='False' />
<FieldRef Name='Created' Ascending='False' />
</OrderBy>";
I just want to know which column will execute first. I am quite unable to understand the flow.
I want order something like that..
IsFreatured1
SortingOrder
Order
Created
The order in which the fields appear in the <OrderBy> node, is the order in which they are sorted.
So, to get the requirement you specified in your question, you have to use this OrderBy statement:
<OrderBy>
<FieldRef Name='IsFeatured1' Ascending='False' />
<FieldRef Name='SortingOrder' Ascending='False' />
<FieldRef Name='Order' Ascending='True' />
<FieldRef Name='Created' Ascending='False' />
</OrderBy>
https://msdn.microsoft.com/en-us/library/office/ms467378.aspx
as the title says i'm trying get some list items from my sharepoint website into my SSRS 2005 report. I tryed to folow and adapt some tutorials for SSRS 2008 like this one :
http://nikspatel.wordpress.com/2010/04/30/step-by-step-consuming-sharepoint-lists-data-in-the-ssrs-reports/
The thing is that I get stuck int the 6th step when I try to validate my query. I tryed to pass some queries that i post below:
<Query>
<SoapAction>http://schemas.microsoft.com/sharepoint/soap/GetListItems
</SoapAction>
<Method Namespace='http://schemas.microsoft.com/sharepoint/soap/' Name = 'GetListItems'>
<Parameters>
<Parameter Name='listName'>
<DefaultValue>EraDemandes</DefaultValue>
</Parameter>
<Parameter Name='rowLimit'>
<DefaultValue>100</DefaultValue>
</Parameter>
<Parameter Name='query' Type='xml'>
<DefaultValue>
<Query>
<Where>
<Eq>
<FieldRef Name='ID'/>
<Value Type='Integer'>1016</Value>
</Eq>
</Where>
</Query>
</DefaultValue>
</Parameter>
<Parameter Name='viewFields' Type='xml'>
<DefaultValue>
<ViewFields>
<FieldRef Name='Title' />
<FieldRef Name='ID' />
</ViewFields>
</DefaultValue>
</Parameter>
<Parameter Name='queryOptions' Type='xml'>
<DefaultValue>
<QueryOptions>
<IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>
<DateInUtc>TRUE</DateInUtc>
</QueryOptions>
</DefaultValue>
</Parameter>
</Parameters>
</Method>
<ElementPath IgnoreNamespaces='True'>*</ElementPath>
</Query>
<Query>
<SoapAction>http://schemas.microsoft.com/sharepoint/soap/GetListItems</SoapAction>
<Method Namespace="http://schemas.microsoft.com/sharepoint/soap/" Name="GetListItems">
<Parameters>
<Parameter Name="listName">
<DefaultValue>Liste des Demandes</DefaultValue>
</Parameter>
</Parameters>
</Method>
<ElementPath IgnoreNamespaces="True">*</ElementPath>
</Query>
I tryed to remove / modify all the parameters without succes. I'm realy not familiar with SSRS so plz go on and ask every question you need.
I have few question myself:
On the 2 queries i used 2 differents name for the list: "EraDemandes" is the name I got in my URL when i'm accessing my list through sharepoint and "Liste des Demandes" is the name of the list in Sharepoint. I beleive that in sharepoint there is 2 name, a display name and a sharepoint name. Which one should i use ?
My root Sharepoint Site collection is 'http://m-epderaqua/default.aspx' and the list I want to casses are on all the subsites from this collection (http://m-epderaqua/ERA73/default.aspx or http://m-epderaqua/ERA38/default.aspx). Which web address should I use in my datasource ? Should i use many datasource (like one for each subsites) ?
Help plz.
I can't tell why but it's just working perfectly fine right now. I suppose the maintenance team did somthing during the week-end but I don't know what...
I am having issues setting more than three filters using the queryoverride property. It works just fine if i pass fixed values to the fields like instead of [PageFieldValue:Primary Office], if i feed in 'XYZ Office' then it is able to read that value and pull content based on it...but not with the PageFieldValue...I am trying to pull content from other pages in the page libray that match the primary office value of the current page...so If I am in Doctor X's page and his primary office is XYZ then it should pull all other doctors from XYZ Office, where XYZ office could be the other doctor's primary office or other extra practice location?? Please any sharepoint GURU??
<Query>
<Where>
<And>
<Neq>
<FieldRef Name='Title' />
<Value Type='Text'>[PageFieldValue:Title]</Value>
</Neq>
<Or>
<Eq>
<FieldRef Name='Office' />
<Value Type='Text'>[PageFieldValue:Primary Office]</Value>
</Eq>
<Or>
<Eq>
<FieldRef Name='Office1Name2' />
<Value Type='Text'>[PageFieldValue:Primary Office]</Value>
</Eq>
<Or>
<Eq>
<FieldRef Name='OtherOffice2Name' />
<Value Type='Text'>[PageFieldValue:Primary Office]</Value>
</Eq>
<Eq>
<FieldRef Name='OtherOffice3Name' />
<Value Type='Text'>[PageFieldValue:Primary Office]</Value>
</Eq>
</Or>
</Or>
</Or>
</And>
</Where>
</Query>
I have the following CAML query:
<Where>
<And>
<Eq>
<FieldRef Name='PublishToSM' />
<Value Type='Boolean'>True</Value>
</Eq>
<IsNull>
<FieldRef Name='SMUpdateDate' />
</IsNull>
</And>
</Where>
I have only one content type that uses these fields. When I run this query against a list that uses this content type everything works fine. When I run it against a List that does not it throws the error: One or more field types are not installed properly. Go to the list settings page to delete these fields.
I would like to be able to search all Lists on all websites in a site collection. Can this be done without erroring out?
Use SPSiteDataQuery, add a where clause to include the content type. i.e.:
<Where>
<And>
<Eq>
<FieldRef Name='ContentType' />
<Value Type='Text'>CONTENTTYPE NAME</Value>
</Eq>
<And>
<Eq>
<FieldRef Name='PublishToSM' />
<Value Type='Boolean'>True</Value>
</Eq>
<IsNull>
<FieldRef Name='SMUpdateDate' />
</IsNull>
</And>
</And>
</Where>
<BeginsWith>
<FieldRef Name='ContentTypeId' />
<Value Type='ContentTypeId'>CONTENTTYPE ID</Value>
</BeginsWith>
Set the SPSiteDataQuery's Scope property to SiteCollection. By setting the Lists property you can also limit the search to for instance document libraries etc. The ViewFields property can be set to limit the fields retrieved (i.e. instead of the equivalent of a select * on the items's fields)