Reputation: 1
I have written a feature(Site scoped) that adds custom menu items to the New Menu. it will create new documents inside the document library.
Below are the sample entries in Feature and Element manifest file
<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="59bba8e7-0cfc-46e3-9285-4597f8085e76" Title="My Custom Menus" Scope="Site" xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="Elements.xml" />
</ElementManifests>
</Feature>
and Elements.xml file is
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="NewMenu1" GroupId="NewMenu" RegistrationType="List" RegistrationId="101" Location="Microsoft.SharePoint.StandardMenu" Sequence="1002" ImageUrl ="/_layouts/images/DOC32.GIF" Title="My New Menu" Rights="AddListItems,EditListItems">
<UrlAction Url="javascript:var surl='{SiteUrl}'; window.location='/test/mypage.aspx?siteurl='+surl+'&listid={ListId}&Source='+window.location" />
</CustomAction>
</Elements>
By the above sample. My New menu is listed in all document library. This new menu is creating a new document under document library. But i have to hide this in some document library. Is this possible? Please suggest me.
Upvotes: 0
Views: 1732
Reputation: 1615
You can hide menu items like this by adding some javascript to a content editor web part. The content editor web part should be put on your page where you want the menu item to be hidden
An example using jQuery is as follows:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("ie\\:menuitem[text='My New Menu']").each(function(){
this.hidden=true;
});
});
</script>
HTH
Upvotes: 1