Monday, May 24, 2010

SPSiteDataQuery - Accessing data using DateTime fields in the query

The following code snippet shows how to access data from a list which contains a DateTime field (Expires) using SPSiteDataQuery object

_query.Lists = "";
_query.ViewFields = "";
_query.Query = "" + SPUtility.CreateISO8601DateTimeFromSystemDateTime(DateTime.Today) + "";
_query.Webs = "";
_query.RowLimit = 3;

NOTE: The above query fetches only 3 records from the list. This will be useful to improve performance of the query, of course based on the business scenario

Technorati Tags: ,,,

No comments:

Post a Comment