Currently Browsing: WSS 3.0

CAML queries, SSRS, and datetime fields

I’ve been using Enesys Software’s product RS Data Extension to query data out of SharePoint 2007 lists in SQL Server (2005) Reporting Services.  One quirk with the queries is that they use CAML and the dates must be in a particular format, ISO8601.

I wanted users to use the standard date-picker, but there is no way to format the date inside the query.  My work-around is a classic Reporting Services pattern – create an internal parameter that does the formatting for you.  The format string for VBScript is “yyyy-MM-ddTHH:mm:ss”.

Below is a screenshot of the Report Parameters dialog. I used the following code to just grab today’s date (no time).

     =CDate(CDate(Now()).ToString("MM/dd/yyyy"))

For the second parameter, I create an internal parameter that is dependent on the first.  This will prevent it from showing on the report and it will not be filled in until the start date is chosen.  Default value:

     =CDate(Parameters!StartDate.Value).ToString("yyyy-MM-ddTHH:mm:ss")

I created a test report to show how this works.  Here is the report definition:

Below is the report preview:  You can now use the parameter in your CAML query.

One other note on CAML date fields.  The time is ignored by default.  If you want to include the time, you must specify another attribute.  Example:

<Geq>
<FieldRef Name="LastModified" />
<Value Type="DateTime" IncludeTimeValue="TRUE">@LastModified!</Value>
</Geq>

I found a helpful post on CAML & DateTime that might be useful for you too.

SharePoint “User not found” error with Reporting Services in integrated mode

I encountered an error the other day while trying to get a SharePoint 2007 (WSS 3.0) site running with SQL Server Reporting Services 2005 in integrated mode.  While trying to access any report .RDL files inside a document library, I got the “User not found” error from SharePoint.  After looking in the logs, I could not find anything.  What I did note, was that the development site worked, but the production site did not.

One difference between them – the names of the Application Pool that SharePoint was running under.  In development it was just “spsite” but in production it was “www.spsite.com”.

I renamed the application pool and *poof*, the site began to work.  I don’t understand the mechanism, but just thought I’d post in case someone else out there encounters it.

UPDATE: I’ve blogged about another reason why you might get the “User not found” error and possible solutions.

Page 2 of 212