Web Part

Specifies a modular component that is used within the SharePoint site to perform activities or display information.

Real World Example

A development team needs to access a back-end bug reporting database to display dynamically updated bug tracking data in Microsoft Office SharePoint Server 2007. They develop a Web Part that can be installed and used on any site in the Office SharePoint Server 2007 environment.

Technical Details

A Web Part is composed of an XML file structure (.dwp or .webpart) that refers to a Web Part assembly, and also can contain other metadata that describes an instance of the Web Part such as default values for properties. Web Parts can also have supporting resources such as graphic images, ECMAScript (JScript, JavaScript) files, cascading style sheets, or HTML or ASPX pages.

Some Web Parts can be used as filters for other Web Parts that access data. Others are used to display static content and some can access and display dynamic data from other SharePoint lists, from databases, from Excel Services, or from the Business Data Catalog.

Support Details

Web Part assemblies can be installed in the bin directory of a Web application or in the global assembly cache, but should not be installed in the _app_bin directory.

Deactivating or removing a Web Part can be difficult because there is no simple built-in way of determining where each Web Part is instantiated. A best practice in the case where the amount of Web Part instances is not known is to adjust the SafeControls list entry for the Web Part class or assembly to no longer be safe, but to instead have a description indicating that any instance of the Web Part should be removed.

<SafeControl Assembly="MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31e9ace121e9429f" Namespace="MyNamespace" TypeName="MyWebPart1" Safe="False" UnsafeErrorMessage="This Web Part has been disabled. Please check back later."/>

Upgrade of Web Parts should normally be handled by the newer Web Part code handling transformation of existing properties to the new structure or removal of deprecated properties. This allows each instance of a Web Part to be upgraded when called next instead of upgrading all instances at one time.