Tuesday, June 16, 2009

Hiding specific item from ECB menu

Hi All,

I am going to share how we can hide a specific item from the ECB menu.

Before starting this topic, I would like to say that even we have the feature method to add the menu item to ECB menu list but there is no reverse way to hide any specific menu item from ECB menu list. The reason behind this is they are rendered by JavaScript file which is core.js.

Now it is not recommended that you modify this core.js JavaScript file. So here what we will do is we will copy the core.js and paste at the same location and rename it with your appropriate name let’s say customcore.js.

Now the other thing to do is allow and render the customcore.js file through the custom masterpage.

Here make a note that we also need core.js file used by custom masterpage, so we use Defer=”true” in as an attribute.

Perform the steps mentioned below.

(1) Copy the core.js and paste it at the same location and rename it to customcore.js
(2) In customcore.js remove the entries that you don’t want in ECB menu list.
(3) Copy the Default.master and rename it to custom.master.
(4) In custom master page add following lines.

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

(5) Save the custom master page, upload it to the master page gallery and apply the custom.master as default master page for your site.

That's it. your job is done.

No comments:




Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com