Adding Custom Quick Access Buttons to the Page Editing Toolbar in SharePoint Server 2007

Summary: Learn how to create and add custom buttons to the Quick Access button area of the Page Editing toolbar used in Microsoft Office SharePoint Server (MOSS) 2007 Web content management (WCM) sites.

Office Visual How To

Applies to: Microsoft Office SharePoint Server 2007, Microsoft Visual Studio 2005

Andrew Connell, Critical Path Training, LLC (Microsoft MVP)

January 2008

Overview

All Microsoft Office SharePoint Server 2007 Web content management (WCM) or publishing sites use the Page Editing toolbar. The Page Editing toolbar provides content authors, owners, and editors with functionality to manage content pages on a site. One of the sections in the Page Editing toolbar—the Quick Access button area—displays buttons for context-sensitive items that are available to authors based on the current state of the page. Developers are free to customize the Quick Access button area, and create custom Quick Access buttons.

Code It

Quick Access buttons in the Page Editing toolbar are founded on the concept of actions. Actions, also known as console actions, can be created by developers to provide a specific type of control.

First, create an action by creating a class that inherits from the Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ConsoleAction class. The custom class then overrides many methods and properties to define the conditions when the button should appear. For example, the UserRights property is a bitwise flag that specifies what permissions the user must have to see the button. The RequiresStates property is another bitwise flag that dictates under what conditions the button should appear.

The last property, href, contains the work payload of the button. When the button is clicked, the href property is used to determine what should happen.

Implementation

After you create the button class, and sign and deploy the assembly to the global assembly cache, the next step is to make the SharePoint publishing site aware of the new button. The Quick Access buttons on the Page Editing toolbar are defined by the QuickAccess.xml file, located in the path [..]\12\TEMPLATE\LAYOUTS\EditingMenu. However, developers should not modify this file. Instead, the QuickAccess.xml file points to the CustomQuickAccess.xml file in the Master Page Gallery of each SharePoint publishing site collection. This file contains a reference that points to the custom console action class and an assembly that contains the class, very much like the <% @Register %> directive in an ASPX or ASCX file. After the reference, the CustomQuickAccess.xml file includes a section declaring the console action, as shown in the following code.

Read It

This article demonstrates how to create and add custom buttons to the Quick Access button area of the Page Editing toolbar used in MOSS 2007 Web content management sites. Following are the steps to create a custom button:

  1. In Visual Studio, create a Class Library project.

  2. Add references to the required assemblies to the Visual Studio project.

  3. Create a class that inherits from the Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ConsoleAction class.

  4. Override necessary methods on the derived ConsoleAction class.

  5. Build and deploy the signed assembly that contains the derived ConsoleAction class to the server’s global assembly cache.

  6. Modify the CustomQuickAccess.xml file to register the new button and notify MOSS about it.

See It Add Quick Access Buttons to Page Editing Toolbar

Watch the Video

Video Length: 00:13:09

File Size: 11.4 MB WMV

Explore It