Customizing Web part shortcut menu (chrome)

Web part shortcut menu allows you to minimize, Close, Modify web part and export. To add new item, edit or modify existing item in menu you need to override CreateWebpartmenu method of WebPart base class and access the MenuItems collection of the Web Part’s WebPartMenu property.
List of Item IDs
• MSOMenu_Minimize
• MSOMenu_Restore
• MSOMenu_Close
• MSOMenu_Delete
• MSOMenu_Edit
• MSOMenu_Connections
• MSOMenu_Export
• MSOMenu_Help

Sample example

public override void CreateWebPartMenu()
{
MenuItem ParentItem, Item1, Item2;

//first we create three menu items 
//one as a parent item, and two submenu items 
//create the parent item 

ParentItem = new MenuItem("ParentItem", "", "ParentItemID");

//create a submenu item with a server event on click 
Item1 = new MenuItem("Item1", "Item1ID", new EventHandler(EventHandlerForItem1));

//create a submenu item with a client event on click 
Item2 = new MenuItem("Item2", "javascript:alert('Item2 was clicked');", "Item2ID");
// We then add the submenu items to the parent item. 


ParentItem.MenuItems.Add(Item1);
ParentItem.MenuItems.Add(Item2);

// We then decide that we'd like to add the parent item after the 
// "Edit Web Part Properties" item in the menu. 
// First we find the index of the "Edit" item 
int EditIndex =
this.WebPartMenu.MenuItems.IndexOf(this.WebPartMenu.MenuItems.ItemFromID("MSOMenu_Edit"));

// Then we insert the parent item after the "Edit" item 
this.WebPartMenu.MenuItems.Insert(EditIndex + 1, ParentItem);


// Make sure the parent item has a separator above it 
ParentItem.BeginSection = true;


// Check a custom property to decide whether to display the parent menu 
if (this.CustomProperty1 == true)
{
ParentItem.Visible = true;
}
else
{
ParentItem.Visible = false;
}
// Check another custom property to decide which menu item to enable 
// within the parent item 
if (this.CustomProperty2 == true)
{
Item1.Enabled = true;
Item2.Enabled = false;
}
else
{
Item1.Enabled = false;
Item2.Enabled = true;
}
}

MOSS 2007 Limits

Microsoft Office SharePoint Server (MOSS) 2007 Limits

Site Collections in a Web Application

50,000

Sites in a Site Collection

250,000

Sub-sites nested under a Site

2,000

Lists on a Site

2,000

Items in a List

10,000,000

Documents in a Library

2,000,000

Documents in a Folder

2,000

Maximum document file size

2GB

Documents in an Index

50,000,000

Search Scopes

1,000

User Profiles

5,000,000

Get to the WebPart Maintenance Page

For quick and easy access to the WebPart Maintenance Page simply append the following to the URL of any page with webparts: “?contents=1”.
So for example if your default page URL will look like this:
If you need to go to the WebPart Maintenance page for this page you would add the above to the end of the URL as follows:
This will open the WebPart Maintenance page for this page.You can delete, close, remove the webparts from the page easily.
Note: The changes made on this page are applicable for all the users.