Example #1
0
        /// <summary>
        /// 获取所有子网站的页面
        /// </summary>
        /// <param name="webCollection">子网站</param>
        /// <param name="siteID"></param>
        /// <param name="query"></param>
        private void GetSubWebPages(SPWebCollection webCollection, Guid siteID, string query)
        {
            foreach (SPWeb subWeb in webCollection)
            {
                DataTable            dtItems = new DataTable();
                SPListItemCollection items   = SPHelper.GetAllSPListItems(siteID, subWeb.ServerRelativeUrl, ConstantClass.PAGESFORM, query, "", 0);

                if (items != null && items.Count > 0)
                {
                    dtItems = GetDataTable(items, subWeb.Url);
                }

                if (dtResult != null && dtResult.Rows.Count > 0)
                {
                    MergeTable(dtItems, dtResult);
                }
                else
                {
                    dtResult = dtItems.Copy();
                }

                SPWebCollection subWebCollection = subWeb.GetSubwebsForCurrentUser();

                if (subWebCollection.Count > 0)
                {
                    GetSubWebPages(subWebCollection, siteID, query);
                }

                subWeb.Dispose();
            }
        }