Anytime you choose to add a Web Part to your SharePoint pages, you’re using the Web Part Gallery. It is the list of Web Parts (grouped by categories) that have been made available to you:
The Web Part Gallery comes pre-populated with a number of default Web Parts. The exact Web Parts that appear depend on what version of SharePoint you have installed as well as what site template was selected when you created your site.
It is important to note that the Web Parts that appear in the gallery are not all of the Web Parts installed and available to you, only the Web Parts that are being presented to you. Each Web Part that you see is actually a description file that lives in the Web Part Gallery list. You can see these description files by browsing to the Web Part Gallery via Site Settings and choosing Web Parts under Galleries:
The description files are a combination of .dwp and .webpart files, along with metadata such as Title, Description, Group and Recommendation settings:
The .dwp format was used in SharePoint 2003 and 2007, and many newer Web Parts use the .webpart format. Both formats are XML files that contain properties needed to create a new instance of a Web Part on a page. You can view the XML file by choosing Edit and then selecting Export or View Xml from the Edit Ribbon:
The XML that you will see is a subset of the properties that are configurable (usually the required properties and a few extras for look and feel). If you export a Web Part instance from a page (see “Moving Web Parts in SharePoint 2010”), you will see many more properties configured.
Each Web Part also contains a preview (if implemented) so you can see what the Web Part might look like. This is an oft-overlooked feature that helps users picture what each Web Part is:
Speaking of overlooked features, the most hidden gem of the Web Part Gallery is its ability to show you what Web Parts are installed on the server. Remember earlier that I said the Web Part Gallery only shows you Web Parts that are being presented to you? That is because unless a feature (usually stapled to a site template) has populated the Gallery for you, many Web Parts that are installed may not show up in the Gallery. By switching to the documents tab of the Ribbon and selecting “New Document,” you are presented with a unique screen that allows you to add “New Web Parts” to your Web Part Gallery:
By selecting the checkbox of a Web Part that you want and then choosing “Populate Gallery,” the .dwp file or .webpart file is dynamically generated for you and saved to the Web Part Gallery.
Now, it is important to note that not all of these Web Parts are meant for general use. Some Web Parts also have prerequisites that may not be present and should only be populated by feature activation. Still, if you know a Web Part exists but don’t see it in your Gallery, you now know where to go to find and add it!
Browsing for installed Web Parts isn’t the only way to populate the Web Part Gallery. Another scenario might be exporting a Web Part and then uploading it to the Gallery to be used as a template. This works great if you have content to be reused on the site, or if you simply want to pre-configure properties like width, height or chrome type.
Hopefully this post has given you some more background into how the Web Part Gallery works and how you can use it more effectively in your organization.
Raymond Mitchell is a consultant with SharePoint911.