Working With Content Query Web Part in SharePoint 2010

Add a Content Query Web Part to the Existing Documents Site:

  1. Open your SharePoint site.
  2. Click the Site Actions drop-down box and select Edit Page.

    QueryShr1.jpg
     
  3. Locate the Right Web Part zone and click the Add a Web Part link. It is located in the body of the page in the right-hand column.

    QueryShr2.jpg
     
  4. Select the Content Rollup category in the Web Part gallery.

    QueryShr3.jpg
     
  5. Select Content Query in the Web Parts pane.

    QueryShr4.jpg
     
  6. Click Add to add the Web Part to the Right Web Part zone.

    QueryShr5.jpg

Task 2: Configure the Content Query Web Part to Display

In this task you configure the new Content Query Web Part to display documents located in document libraries that are based on the Contoso content type and have a Confidentiality Level value of Partners.

  1. Click the "open the tool pane" link displayed in the Content Query Web Part:

    QueryShr6.jpg
     
  2. Expand the Query Category in the Web Part Property Pane.
  3. Select the Show items from the following Site and all subsites radio button.
  4. Click the Browse button and select the Documents site.

    QueryShr7.jpg
     
  5. Click OK.
  6. Select Document Library for the List Type.

    QueryShr8.jpg
     
  7. Select "Custom Content Types" for the value from the first (the "Content Type") drop-down box.
  8. Select "Contracts" for the value from the second (the "Show items of this content type") drop-down box.

    QueryShr9.jpg
     
  9. Set the first Additional Filter to show items when the Confidentiality Level is equal to Partners.

    a. Select ConfidentialityLevel in the first drop-down box.
    b. Select is equal to in the second drop-down box.
    c. Select the iconQueryShr10.jpg located next to the criteria text box to select the confidentiality level.

    QueryShr11.jpg

    d. Click on the data set. Click Select and then OK.

    QueryShr12.jpg
     
  10. Expand the Presentation node in the Web Part Property Pane.
  11. Verify that the Sort Item by drop-down box is set to Created.
  12. Verify that Sort is set for descending order.
  13. Set the Limit the number of items to display to 10.

    QueryShr13.jpg
     
  14. Verify the Group style is set to Default.
  15. Select Title, description and document icon for the Item style.

    QueryShr14.jpg
     
  16. Expand the Appearance node in the Web Part Property Pane.
  17. Set the Title to Confidential Level – Partner Documents.
  18. Click the OK button located at the bottom of the Web Part Property Pane.
  19. Click the Stop Editing ribbon button.

The Content Query Web Part should now display a list of documents that contains Partners in the Confidential column. The style should match the surrounding

QueryShr15.jpg
 

Up Next
    Ebook Download
    View all
    Learn
    View all