Mohsin
Mohsin

Reputation: 1

How to use SPSIteDataQuery to get all site collection list Having same column name?

I am having one site collection that has two sub sites subSite1 and subSite2.

If there are 1000 sub site and 1000 list with same column name then how to get that 1000 list using single query.

Upvotes: -1

Views: 543

Answers (1)

Arjun
Arjun

Reputation: 67

You may use the below code to get the required result:

SpDataqry.Lists="<Lists ServerTemplate=\"107\"/>";
SpDataqry.ViewFields="><FieldRef Name=\"Title\"/><FieldRef Name=\"Priority\" Nullable=\"TRUE\" Type=\"Text\"/>";
SpDataqry.Query="<OrderBy><FieldRef Name=\"Title\"/></orderBy> ";
SpDataqry.Webs="<Webs Scope="\SiteCollection\" />";

List template 107- is used for Task Lists. You can get List Template Id for other lists Here

Webs scope is set to Site collection level to get data from root site and sub sites below it.

Upvotes: 0

Related Questions