Click to Rate and Give Feedback
MSDN
MSDN Library
Office Development
SDK Documentation
 GetCachedSiteDataQuery Method
Community Content
In this section
Statistics Annotations (1)
Collapse All/Expand All Collapse All
This page is specific to
The 2007 product release

Other versions are also available for the following:
PortalSiteMapProvider.GetCachedSiteDataQuery Method (Microsoft.SharePoint.Publishing.Navigation)
Returns the cached result of a SiteDataQuery object.

Namespace: Microsoft.SharePoint.Publishing.Navigation
Assembly: Microsoft.SharePoint.Publishing (in microsoft.sharepoint.publishing.dll)
Visual Basic (Declaration)
Public Function GetCachedSiteDataQuery ( _
    webNode As PortalWebSiteMapNode, _
    query As SPSiteDataQuery, _
    contextWeb As SPWeb _
) As DataTable
Visual Basic (Usage)
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)
C#
public DataTable GetCachedSiteDataQuery (
    PortalWebSiteMapNode webNode,
    SPSiteDataQuery query,
    SPWeb contextWeb
)

Parameters

webNode

PortalWebSiteMapNode object that represents the Web site that contains the data.

query

SPSiteDataQuery to run.

contextWeb

SPWeb object that exists within the context of a particular user. For example, this parameter can specify the SPContext.Current.Web object.

Return Value

The result returns only major or minor versions, not items that are checked out to the current user.

The contextWeb property is used to determine the correct items to return.

The following example references the following assemblies:

  • 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

C#
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;
        }

    }

}
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
SPSiteDataQuery limitations      Reza Alirezaei - MVP   |   Edit   |   Show History
When using SPSiteDataQuery or PortalSiteMapProvider.GetCachedSiteDataQuery object ( which returns the cached result of a SPSiteDataQuery object), be aware of the limitations you may face. For more information , see http://support.microsoft.com/kb/946484

Reza Alirezaei,MVP
http://blogs.devhorizon.com/reza

Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker