PortalSiteMapProvider.GetCachedSiteDataQuery Method
Returns the cached result of a SiteDataQuery object.
Assembly: Microsoft.SharePoint.Publishing (in Microsoft.SharePoint.Publishing.dll)
public DataTable GetCachedSiteDataQuery(
PortalWebSiteMapNode webNode,
SPSiteDataQuery query,
SPWeb contextWeb
)
Parameters
- webNode
- Type: Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode
PortalWebSiteMapNode object that represents the Web site that contains the data.
- query
- Type: Microsoft.SharePoint.SPSiteDataQuery
The SPSiteDataQuery to run.
- contextWeb
- Type: Microsoft.SharePoint.SPWeb
The SPWeb object that exists within the context of a particular user. For example, this parameter can specify the SPContext.Current.Web object.
Return Value
Type: System.Data.DataTableThe result returns only major or minor versions, not items that are checked out to the current user.
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
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; } } }