Sharepoint 浏览所有网站和交叉列表

Sharepoint 浏览所有网站和交叉列表,sharepoint,web-parts,Sharepoint,Web Parts,我希望遍历所有网站和子网站,找到同名的列表,并将它们与子列表优先级相交,并在repeater中的web部件中显示结果。列表包含标题,名称,链接 到目前为止,我有以下几点: using (SPSite oSPsite = new SPSite("http://niki/default.aspx")) { SPWebCollection siteWebs = oSPsite.AllWebs;

我希望遍历所有网站和子网站,找到同名的列表,并将它们与子列表优先级相交,并在repeater中的web部件中显示结果。列表包含
标题
名称
链接

到目前为止,我有以下几点:

 using (SPSite oSPsite = new SPSite("http://niki/default.aspx"))
                {

                    SPWebCollection siteWebs = oSPsite.AllWebs;
                    foreach (SPWeb web in siteWebs)
                    {
                        web.AllowUnsafeUpdates = true;
                        try
                        {
                            SPList list = null;
                            try
                            {
                                list = web.Lists[ListName];
                            }
                            catch { }

                            if (list != null)
                            {

                                list.EnableModeration = true;
                                SPListItemCollection collection = list.GetItems(list.DefaultView);
                                repeater.DataSource = collection;
                                repeater.DataBind();
                                list.Update();
                            }
                        }
                        finally
                        {
                            if (web != null)
                                web.Dispose();
                        }
                    }

结果只显示了最后一次迭代,没有实现交集。我不知道如何添加两个SPListItemCollection,或者有其他方法吗?谢谢。

您可以使用列表存储所需的数据,也可以自己定义数据结构