Create custom context menu in Sharepoint Document Library

There are two very simple technique to create context menu in SharePoint 2010.

Approach1 .

This approach will use feature to create and deploy the context menu in document library.

Drawback: Once feature will be activated, the context menu will be available in all document library.



Create an feature file as below named Feature.xml.

<?xml version=”1.0″ encoding=”utf-8″ ?>

<Feature xmlns=”



Title=”Open as Word 2003″


Description=”Displays Open as Word 2003 link in context menu of a document library.”>


<ElementManifest Location=”MenuItems.xml”/>




Create an menufest file as below named MenuItems.xml which contain the behavior of menu.

<?xml version=”1.0″ encoding=”utf-8″ ?>

<Elements xmlns=”“>




ShowInLists = “True”




Title=”Move To”>

<UrlAction Url=”~site/SitePages/Home.aspx?ID={ItemId}&amp;List={ListId}”/>





Create a page in page library for redirection and replace the path in the MenuItems.xml file as you can see in the bold on.


Final work, install and activate the feature.

Create a folder in the 12 hives under Features folder named CustomMenu, and paste the both file (Feature.xml, MenuItems.xml) in the CustomMenu folder.

And now execute the below command, that’s all.

stsadm -o installfeature -name CustomMenu

stsadm -o activatefeature -name CustomMenu -url  “your site url”

Approach 2.

Custom context menu can also be created by SharePoint Designer 2010.

you can visit on the below site.


3 thoughts on “Create custom context menu in Sharepoint Document Library

  1. Hi sanjiv,

    Thanks for the clearcut explanation. I tried to add context menu to my documetn library using the same. But i could not able to see the newly added menu in context menu.
    kindly correct me whr im wrong. btw im using Moss 2007

    i have created the welcome page, and also installed and activated the feature, i can see the feature status as activated in site features section.

    • Hi Geetha,

      It looks, feature has not been installed and activated in the site, you should see the feature in site feature list.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s