Document management with SharePoint - part 4
Written By: Knox Cameron -- 10/6/2011 --
(80) comments --
Categories: Configurations, Design, Document Management, Programming and Customizations, Search, SharePoint 2010, SharePoint Foundation 2010
< Prev -
- Next >
| Become a paid author
Using Content Query to show a list of documents across sites
When you have consistently used content types, you can then easily use the
Content Query web part to show a summary of items across multiple sites. For
example, here is how we can show a summary of our product proposal documents
from all sites in the site collection on the home page.
Edit the home page (Site Actions > Edit Page). In one of the web part zones,
select the link to Add a Web Part. From the Content Rollup category, select the
Content Query web part, then click Add.
Within the new web part, click the link to open the tool pane. In the tool
pane, expand the Query heading.
Note that you have the option to show items from all sites in the site
collection, or from a specific site and its subsites, or from a specific list.
For the purpose of this demonstration, we will show items from all sites in the
- For production use, use the most specific option you can - either a
specific list or specific site and subsites. Performing a query across the
whole site collection can significantly slow down display of the page, so
avoid using that option for a large site collection.
Under list type, select Document Library. Under content type, select the
Product proposal content types group and Product proposal content type. Note
that this will include child content types.
Scroll down and open the Presentation heading. Select the option to group
items by site. Note the other options to display multiple columns, sort the
results, limit the number of items displayed and use different grouping styles.
By default, the web part will show the newest 15 documents.
Scroll down further and open the Appearance heading. Set the web part title
to something meaningful like "Latest product proposal documents". At the very
bottom, select OK to apply the settings to the web part.
The web part is now showing documents from document libraries in two
different sites, both using the same content types. Note that content query
automatically uses the document title rather than the file name.
The content query web part can also show a description for each item. In
theory, you should be able to use the built-in Comments site column for this
purpose, but unfortunately there is an issue with the content query web part so
this column doesn't work (see
Inconvenient Content Query Web Part slots for the technical background).
Instead, open the parent content type and select the option under columns to add
from new site column. Call it "Proposal Doc Description" and select the Multiple
lines of text option.
Further down, enter an appropriate description. Select the type of text as
plain text (rich text can be problematic).
Select OK. If you go to any of the libraries where the content types are
used, you will find that the new column has been added to the library, but not
to any views. Add the column to appropriate views, and use the datasheet option
to quickly enter information into it for the documents (see
Management with SharePoint 2010 - Part 1 (page 2) for more details).
Once you have done this, edit the home page again. We need to tell the
content query web part to use our new custom column as the description. Select
Edit Web Part from the content query web part's menu.
Open the presentation heading. Change the number of columns to 2. Change the
item style to Title and description. Under Fields to display, add Proposal Doc
Description to the Description field.
Select OK and save and check in the page. Now we have a nice 2-column summary
of the latest product proposal documents, with titles and descriptions, grouped
< Prev -
- Next >
- Conduct an inventory of the types of documents you use, and try to
construct some logical content type hierarchies.
- Assemble some templates, and create a parent and some child content
types. Assign them to libraries, and try them out.
- Build a content query to show your documents. Show the results to your
colleagues and see how impressed they are!
- For information about publishing InfoPath forms as a content type, see
Reusing InfoPath forms as Content Types - Part 1
- For information on how to share content types across site
collections using the managed metadata service, see
Publish Content Types with the Managed Metadata Service
- Look at part 1,
and part 3 of this series for information about
using metadata in views, customizing views in the browser and SharePoint Designer,
and making use of metadata inside documents.
- Return to MSSharepointTips to read about other topics and ideas.
- Check out MSSQLTips.com for great
information about Microsoft SQL Server.