Hide ECB Menu Item in SharePoint Lists

10 04 2009

Let’s face it, the SharePoint ECB menu contains lots of items that may not be required for a simple system.

It is possible by creating a custom version of the CORE.JS file to hide any required menu items from the ECB drop-down menu – betware though this will hide it for the entire site collection.

Let’s say we want to hide the ‘Check Out’ option:

Untitled-1

Make a copy of the CORE.JS file from the following location on the SharePoint Server:

12 Hive\TEMPLATE\LAYOUTS\1033\CORE.JS

Name this copy CUSTOMCORE.JS. Next open this file with SharePoint Designer or a standard text editor, find and comment out the following line:

AddCheckinCheckoutMenuItem(m, ctx, currentItemEscapedFileUrl);

Save the file and now open your master page (normally default.master). You will probably need to do this with SharePoint designer, add the following line to the head of the page:

<SharePoint:ScriptLink language="javascript" name="core.js" Defer="true" runat="server"/> <SharePoint:ScriptLink language="javascript" name="customcore.js" Defer="true" runat="server"/>

Save the masterpage and head over to your SharePoint site, you should now see that the ECB menu is missing the ‘Check Out’ option:

Untitled-2

You can do this with each of the menu items that you need to hide, simply comment out the ‘Add’ code for the menu item – e.g. The workflows method is AddWorkflowsMenuItem.

Hope this helps some one! 🙂

PLEASE NOTE:

If you want to hide the Check Out menu item from All users you will need to publish a Major version of the master page in the ‘Masterpage Gallery’ of the site. Simply click edit properties (because we can no longer check out using the menu! – unless you sign in as a different user of course), check out then check back in. You will then get the option to publish a major version, once this has been approved it will be available to all users.

Advertisements

Actions

Information

2 responses

18 07 2009
sanket shah

Hey,

Very nice article and good information!!

I have different situation from this and I am looking for solution, can you please help me for this?

I would like to remove menu items “Edit Item” from specific custom list, if I go with above solution then it will remove ECB menu from all custom list, but what I need to do for removing option from only one list.

OR

Is there any way in which I can change URL of “Edit Item” page from EditItem.aspx to my layouts custom ASPX page? In SP designer, while changing page name (supporting files) from custom list, I can’t see files from layouts folder ..

Actually finally I am looking for to give my custom ASPX page URL into “Edit Item” option or hide that option from specific list and add new custom action which will point to new layouts page, I already added new custom action into Edit Control block. But I am facing some of the challenges with other items.

Thank you very much for your time.

Thanks,
Sanket Shah

2 02 2011
Sumit Zitshi

Informative article.
i have a question. What to do in case we are supporting multiple language packs?
I guess, we’ll have to make separate Core.js files for each language.

Please comment.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s




%d bloggers like this: