Partager via


PortalSiteMapProvider.GetCachedSiteDataQuery - Méthode

Renvoie le résultat en cache d'un objet SiteDataQuery .

Espace de noms :  Microsoft.SharePoint.Publishing.Navigation
Assembly :  Microsoft.SharePoint.Publishing (dans Microsoft.SharePoint.Publishing.dll)

Syntaxe

'Déclaration
Public Function GetCachedSiteDataQuery ( _
    webNode As PortalWebSiteMapNode, _
    query As SPSiteDataQuery, _
    contextWeb As SPWeb _
) As DataTable
'Utilisation
Dim instance As PortalSiteMapProvider
Dim webNode As PortalWebSiteMapNode
Dim query As SPSiteDataQuery
Dim contextWeb As SPWeb
Dim returnValue As DataTable

returnValue = instance.GetCachedSiteDataQuery(webNode, _
    query, contextWeb)
public DataTable GetCachedSiteDataQuery(
    PortalWebSiteMapNode webNode,
    SPSiteDataQuery query,
    SPWeb contextWeb
)

Paramètres

  • contextWeb
    Type : Microsoft.SharePoint.SPWeb

    L'objet SPWeb qui existe dans le contexte d'un utilisateur particulier. Par exemple, ce paramètre peut spécifier l'objet SPContext.Current.Web .

Valeur renvoyée

Type : System.Data.DataTable
Le résultat retourne les versions uniquement majeures ou mineures, pas les éléments qui sont extraits à l'utilisateur actuel.

Remarques

Le paramètre contextWeb est utilisé pour déterminer les éléments corrects à retourner.

Exemples

L'exemple suivant référence les assemblys suivants :

  • 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 GetCachedSiteDataQuerySample
    {
        // Runs a given site data query against the cache and returns the results.
        // Note: You must call this method from within an HttpContext object (for example, HttpContext.Current 
        // must return a valid HttpContext).

        public DataTable GetCachedSiteDataQuery(string webUrl, SPSiteDataQuery siteDataQuery)
        {
            PortalSiteMapProvider portalProvider = PortalSiteMapProvider.CurrentNavSiteMapProviderNoEncode;
            PortalWebSiteMapNode webNode = portalProvider.FindSiteMapNode(webUrl) as PortalWebSiteMapNode;
            if (webNode != null)
            {
                return portalProvider.GetCachedSiteDataQuery(
                    webNode, siteDataQuery, SPContext.Current.Web);
            }
            return null;
        }

    }

}
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 GetCachedSiteDataQuerySample
        ' Runs a given site data query against the cache and returns the results.
        ' Note: You must call this method from within an HttpContext object (for example, HttpContext.Current 
        ' must return a valid HttpContext).

        Public Function GetCachedSiteDataQuery(ByVal webUrl As String, ByVal siteDataQuery As SPSiteDataQuery) As DataTable
            Dim portalProvider As PortalSiteMapProvider = PortalSiteMapProvider.CurrentNavSiteMapProviderNoEncode
            Dim webNode As PortalWebSiteMapNode = TryCast(portalProvider.FindSiteMapNode(webUrl), PortalWebSiteMapNode)
            If webNode IsNot Nothing Then
                Return portalProvider.GetCachedSiteDataQuery(webNode, siteDataQuery, SPContext.Current.Web)
            End If
            Return Nothing
        End Function

    End Class

End Namespace

Voir aussi

Référence

PortalSiteMapProvider classe

PortalSiteMapProvider - Membres

Microsoft.SharePoint.Publishing.Navigation - Espace de noms

PortalSiteMapProvider