다음을 통해 공유


CbqQueryCache Constructor

Creates a CbqQueryCache object used to access and cache queries and results of queries made by the RSS feed pageof a ContentByQueryWebPart object.

Namespace:  Microsoft.SharePoint.Publishing
Assembly:  Microsoft.SharePoint.Publishing (in Microsoft.SharePoint.Publishing.dll)

Syntax

'Declaration
Public Sub New ( _
    feed As Cache, _
    web As String, _
    page As Guid, _
    webpart As Guid, _
    cacheTime As Integer, _
    query As String _
)
'Usage
Dim feed As Cache
Dim web As String
Dim page As Guid
Dim webpart As Guid
Dim cacheTime As Integer
Dim query As String

Dim instance As New CbqQueryCache(feed, web, _
    page, webpart, cacheTime, query)
public CbqQueryCache(
    Cache feed,
    string web,
    Guid page,
    Guid webpart,
    int cacheTime,
    string query
)

Parameters

  • web
    Type: System.String

    The server-relative URL of the Web of the page that the ContentByQueryWebPart is on.

  • page
    Type: System.Guid

    The ID of the CachedPage that the ContentByQueryWebPart is on.

  • webpart
    Type: System.Guid

    The ID of the ContentByQueryWebPart.

  • cacheTime
    Type: System.Int32

    The maximum time in seconds that data from a ContentByQueryWebPart should be valid in the cache.

  • query
    Type: System.String

    The query string of the RSS feed URL.

Exceptions

Exception Condition
UnauthorizedAccessException

The current user is not authorized to get the page.

InvalidOperationException

The ContentByQueryWebPart does not have an RSS feed enabled.

Remarks

The CbqQueryCache class is used to get the CbqQueryVersionInfo object and perform queries for the feed page of ContentByQueryWebPart objects.

When getting the CbqQueryVersionInfo, the CbqQueryCache first checks the feed cache parameter. If the CbqQueryVersionInfo is in the feed cache parameter and the cached version has not exceeded the cacheTime parameter, then this is returned.

The ContentByQueryWebPart can query a ContentByQueryWebPart RSS feed by calling the GetSiteData object.

Examples

By default, the feed page requires these query parameters:

string webUrl = Request.QueryString["web"];Guid pageGuid = new Guid(Request.QueryString["page"]);Guid webpartGuid = new Guid(Request.QueryString["wp"]);CbqQueryCache cbqCache = new CbqQueryCache(HttpContext.Current.Cache, webUrl, pageGuid, webpartGuid, 120, Request.Url.Query);CbqQueryVersionInfo queryVersionInfo = cbqCache.UserQueryVersionInfo;

See Also

Reference

CbqQueryCache Class

CbqQueryCache Members

Microsoft.SharePoint.Publishing Namespace