Share via


ContentByQueryWebPart Class

A Web Part object that is used to retrieve dynamic information.

This API is not CLS-compliant. 

Inheritance Hierarchy

System.Object
  System.Web.UI.Control
    System.Web.UI.WebControls.WebControl
      System.Web.UI.WebControls.Panel
        System.Web.UI.WebControls.WebParts.Part
          System.Web.UI.WebControls.WebParts.WebPart
            Microsoft.SharePoint.WebPartPages.WebPart
              Microsoft.SharePoint.WebPartPages.BaseXsltDataWebPart
                Microsoft.SharePoint.WebPartPages.DataFormWebPart
                  Microsoft.SharePoint.Publishing.WebControls.CmsDataFormWebPart
                    Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart
                      

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

Syntax

'Declaration
<CLSCompliantAttribute(False)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public Class ContentByQueryWebPart _
    Inherits CmsDataFormWebPart _
    Implements INamingContainer, IWebPartVariationUpdate
'Usage
Dim instance As ContentByQueryWebPart
[CLSCompliantAttribute(false)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public class ContentByQueryWebPart : CmsDataFormWebPart, 
    INamingContainer, IWebPartVariationUpdate

Remarks

A ContentByQueryWebPart object uses the CrossListQueryCache object to retrieve data. The data retrieved is cleaned and then sent to the XSLT engine. The XSLT engine uses the defaultHeader.xsl, defaultItem.xsl, and defaultMain.xsl files to translate the data into HTML markup that is presented to the user. You can customize the HTML output of the ContentByQueryWebPart by using the XSL transform. The DataProcessDelegate allows you to retrieve data to be modified before it is sent to the XSLT engine. If the P**[:Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.Data]** property of this Web Part is specified, the data is not retrieved and the specified data is used instead. The ContentByQueryWebPart object derives from the CmsDataFormWebPart object that caches XSLT transforms.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

ContentByQueryWebPart Members

Microsoft.SharePoint.Publishing.WebControls Namespace

CrossListQueryCache

ContentByQueryWebPart

Inheritance Hierarchy

System.Object
  System.Web.UI.Control
    System.Web.UI.WebControls.WebControl
      System.Web.UI.WebControls.Panel
        System.Web.UI.WebControls.WebParts.Part
          System.Web.UI.WebControls.WebParts.WebPart
            Microsoft.SharePoint.WebPartPages.WebPart
              Microsoft.SharePoint.WebPartPages.BaseXsltDataWebPart
                Microsoft.SharePoint.WebPartPages.DataFormWebPart
                  Microsoft.SharePoint.Publishing.WebControls.CmsDataFormWebPart
                    Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart
                      Microsoft.SharePoint.Portal.WebControls.ListingSummary