Visit our SharePoint Forum

SharePoint developer? Submit Yourself as Freelancer

Tuesday, March 25, 2008

SPSiteDataQuery






SPSiteDataQuery Describes a query performed across multiple lists, which may be located in multiple Web sites in the same Web site collection.

You Can query multiple lists/Libraries of same kind for common fields in them. This Query returns a Datatable,which can be used as a source to a Calendar or GridView etc.

Query above will serach all the lists(Specified by Basetype = '0') for column name "EventDate" and value as Today's date. And returns Title , EventDate,Description,ListName(custom field in event List) in a form of a Table.


You can also Specify the List's to search in the scope! You need to provide the Guid of the List for that .

2 comments:

Sreenivas Gudipati said...

Hi isha,
I wanted to retreive more than 1000 Lists data in my web application, how can we use SPSiteDataQuery in this situation. ? Let me know,

Cheers

Saurabh said...

Hi Isha

I have few Questions...can u plz give me any Idea for these....

1. Can we use SPSiteDataQuery at two SPLists where One is at TopLevel and Another one is at SiteLevel ?
2. I have Two Lists ListA and ListB
In ListA i have two sitecolumns ID (counter) and DepartmentName(Text)...............This List is at TopLevel Website
In ListB i have three site columns ID (counter), employeeName(Text) and LookupID(this is a LookupColumn of ListA with field "ID".....This List is at Child Site Level.

Now i want to create query where ListB "ID"='somevalue' and want to show DepartmentName........i tried it with SPSiteDataQuery......
but it doesn't return any record..........

can u plz help me out...........

SharePoint Programming