Метод PortalSiteMapProvider.GetChildNodes (PortalSiteMapNode, NodeTypes, NodeTypes, OrderingMethod, AutomaticSortingMethod, Boolean, Int32)
Возвращает коллекцию дочерних узлов указанного родительского узла, типы узлов для включения скрытых узлов для включения, отсортированный, ограничиваются безопасности и параметры сортировки.
Пространство имен: Microsoft.SharePoint.Publishing.Navigation
Сборка: Microsoft.SharePoint.Publishing (в Microsoft.SharePoint.Publishing.dll)
Синтаксис
'Декларация
Public Overridable Function GetChildNodes ( _
node As PortalSiteMapNode, _
includedTypes As NodeTypes, _
includedHiddenTypes As NodeTypes, _
ordering As OrderingMethod, _
method As AutomaticSortingMethod, _
ascending As Boolean, _
lcid As Integer _
) As SiteMapNodeCollection
'Применение
Dim instance As PortalSiteMapProvider
Dim node As PortalSiteMapNode
Dim includedTypes As NodeTypes
Dim includedHiddenTypes As NodeTypes
Dim ordering As OrderingMethod
Dim method As AutomaticSortingMethod
Dim ascending As Boolean
Dim lcid As Integer
Dim returnValue As SiteMapNodeCollection
returnValue = instance.GetChildNodes(node, _
includedTypes, includedHiddenTypes, _
ordering, method, ascending, lcid)
public virtual SiteMapNodeCollection GetChildNodes(
PortalSiteMapNode node,
NodeTypes includedTypes,
NodeTypes includedHiddenTypes,
OrderingMethod ordering,
AutomaticSortingMethod method,
bool ascending,
int lcid
)
Параметры
node
Тип: Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNodeУзел, чьи дочерние узлы возвращаются.
includedTypes
Тип: Microsoft.SharePoint.Publishing.NodeTypesТипы дочерних узлов для возврата.
includedHiddenTypes
Тип: Microsoft.SharePoint.Publishing.NodeTypesТипы, которые должны возвращать, даже если скрыты.
ordering
Тип: Microsoft.SharePoint.Publishing.OrderingMethodТип заказа для использования.
method
Тип: Microsoft.SharePoint.Publishing.AutomaticSortingMethodМетод сортировки для использования с автоматической сортировки.
ascending
Тип: System.BooleanСледует ли использовать по возрастанию или по убыванию.
lcid
Тип: System.Int32КОД языка для языка и региональных параметров сортировки.
Возвращаемое значение
Тип: System.Web.SiteMapNodeCollection
Коллекция дочерних узлов типа указан, сортируются как указано.
Примеры
Следующий пример ссылается на следующие сборки:
System.dll
System.Data.dll
System.Xml.dll
System.Web.dll
System.Configuration.dll
Microsoft.SharePoint.dll
Microsoft.SharePoint.Library.dll
Microsoft.SharePoint.Publishing.dll
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Web;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Navigation;
using Microsoft.SharePoint.Publishing;
using Microsoft.SharePoint.Publishing.Navigation;
namespace Microsoft.SDK.SharePointServer.Samples
{
class GetChildNodesSample
{
// Get a list of the navigation headings beneath a specified
// Web site in current navigation. This method must be called from
// within a current and valid HttpContext object.
public static List<string>GetNavigationHeadingTitles(string serverRelativeWebUrl)
{
List<string> titles = null;
// Get a reference to the current navigation provider:
// the one that doesn't HTML-encode titles.
PortalSiteMapProvider portalProvider = PortalSiteMapProvider.CurrentNavSiteMapProviderNoEncode;
// lookup the node for the given Web site URL.
PortalWebSiteMapNode webNode =
portalProvider.FindSiteMapNode(serverRelativeWebUrl) as PortalWebSiteMapNode;
if (webNode != null)
{
// Retrieve the heading nodes beneath the
// specified Web site.
SiteMapNodeCollection headingNodes =
portalProvider.GetChildNodes(webNode, NodeTypes.Heading, NodeTypes.None);
titles = new List<string>(headingNodes.Count);
foreach (PortalSiteMapNode headingNode in headingNodes)
{
// Add the title to the list.
titles.Add(headingNode.Title);
}
}
// Return the list of titles.
return titles;
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Data
Imports System.Web
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Navigation
Imports Microsoft.SharePoint.Publishing
Imports Microsoft.SharePoint.Publishing.Navigation
Namespace Microsoft.SDK.SharePointServer.Samples
Friend Class GetChildNodesSample
' Get a list of the navigation headings beneath a specified
' Web site in current navigation. This method must be called from
' within a current and valid HttpContext object.
Public Shared Function GetNavigationHeadingTitles(ByVal serverRelativeWebUrl As String) As List(Of String)
Dim titles As List(Of String) = Nothing
' Get a reference to the current navigation provider:
' the one that doesn't HTML-encode titles.
Dim portalProvider As PortalSiteMapProvider = PortalSiteMapProvider.CurrentNavSiteMapProviderNoEncode
' lookup the node for the given Web site URL.
Dim webNode As PortalWebSiteMapNode = TryCast(portalProvider.FindSiteMapNode(serverRelativeWebUrl), PortalWebSiteMapNode)
If webNode IsNot Nothing Then
' Retrieve the heading nodes beneath the
' specified Web site.
Dim headingNodes As SiteMapNodeCollection = portalProvider.GetChildNodes(webNode, NodeTypes.Heading, NodeTypes.None)
titles = New List(Of String)(headingNodes.Count)
For Each headingNode As PortalSiteMapNode In headingNodes
' Add the title to the list.
titles.Add(headingNode.Title)
Next headingNode
End If
' Return the list of titles.
Return titles
End Function
End Class
End Namespace
См. также
Справочные материалы
Элементы PortalSiteMapProvider
Пространство имен Microsoft.SharePoint.Publishing.Navigation