How to Create Context Menus on Pages Document Library in SharePoint 2013

Sathish Nadarajan
SharePoint MVP
Published On :   02 Apr 2015
Visit Count
Today :  2    Total :   8149
Plan, Migrate, Secure, Report
SharePoint & Office 365 Tool. Simple & Easy to Use. 15-Day Trial!

SharePoint Office 365 Tool
Simple & Powerful Tool for Migration, Security & Reporting. Free Trial

As usual, I met with a new requirement and thought of sharing this to the community. I want to have a Context Menu on the Pages Document Library and on click of it, I need to do some functionality.

The requirement can be understood better with the below Screen shot.


Now, let us see how to do that using Visual Studio.

1. Create a Blank SharePoint Project Using Visual Studio.

2. Add an Empty Element.

3. Modify the Element.xml.

 <CustomAction Id="ContextMenus.Demo"
     <UrlAction Url="javascript:DemoFunction();
                function DemoFunction() 

4. That’s it. Rebuild and Deploy. A new Context Menu will be created on the Pages Doc Library.


5. That’s it. We have our own context menu and on click of it, we can do whatever we want. But only thing is, we can write some javascripts only. If we want to have some server side code needs to be written, then by using Ajax calls, we can consume the Server Side Web Methods.

Download the Source HERE

Happy Coding.

Sathish Nadarajan.

SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.

Migratiin Tools for SharePoint