Reputation: 1
I am having one site collection that has
two sub sites subSite1
and subSite2
.
subSite1
Having List EMP_info
with Column name Title and Dept
.subSite2
Having List DEPT_info
with column name Title and Dept_ID
.EMP_info
and DEPT_info
on RootSite Visual Web Part.SPSiteDataQuery
writing two separate
queries.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
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