///// <summary> ///// Visits the web. ///// </summary> ///// <param name="rootNode">The root node.</param> ///// <param name="web">The web.</param> //private void VisitWeb(ISPSTreeNode<ISPSHierarchyNode> rootNode, SPWeb web) //{ // SPSTreeNode<ISPSHierarchyNode> newNode = rootNode.Add(NodeFactory.MakeWebNode(web)); // if (newNode.Deep < Filter.MaxDeepth) // { // if (Filter.IncludeLists) // { // VisitList(newNode, web); // } // } // VisitSubWebs(newNode,web); //} private void VisitWeb(ISPSTreeNode <ISPSHierarchyNode> rootNode, SPWeb web) { if (rootNode.Deep < Filter.MaxDeepth) { if (Filter.IncludeLists) { VisitList(rootNode, web); } } foreach (SPWeb subWeb in web.GetSubwebsForCurrentUser()) { ISPSTreeNode <ISPSHierarchyNode> newNode = rootNode.Add(NodeFactory.MakeWebNode(subWeb)); if (newNode.Deep < Filter.MaxDeepth) { if (Filter.Apply(web)) { VisitWeb(newNode, subWeb); } } subWeb.Dispose(); } if (Filter.SortHierarchy) { rootNode.Sort(); } }
/// <summary> /// Visits the folder. /// </summary> /// <param name="rootNode">The root node.</param> /// <param name="list">The list.</param> /// <param name="rootFolder">The root folder.</param> private void VisitFolder(ISPSTreeNode <ISPSHierarchyNode> rootNode, SPList list, SPFolder rootFolder) { foreach (SPFolder folder in rootFolder.SubFolders) { if (Filter.Apply(folder)) { ISPSTreeNode <ISPSHierarchyNode> newNode = rootNode.Add(NodeFactory.MakeFolderNode(list, folder)); if (newNode.Deep < Filter.MaxDeepth) { VisitFolder(newNode, list, folder); } } } if (Filter.SortHierarchy) { rootNode.Sort(); } }
/// <summary> /// Visits the list. /// </summary> /// <param name="rootNode">The root node.</param> /// <param name="web">The web.</param> private void VisitList(ISPSTreeNode <ISPSHierarchyNode> rootNode, SPWeb web) { foreach (SPList list in web.Lists) { if (Filter.Apply(list)) { ISPSTreeNode <ISPSHierarchyNode> newNode = rootNode.Add(NodeFactory.MakeListNode(list)); if (newNode.Deep < Filter.MaxDeepth && Filter.IncludeFolders) { VisitFolder(newNode, list, list.RootFolder); } } } if (Filter.SortHierarchy) { rootNode.Sort(); } }