with - sharepoint wiki library template



SharePoint problem while adding custom menu item in document library (1)

you may need to try and elevate their permissions in the code.

SPSecurity.RunWithElevatedPrivileges(delegate()
{
    using (SPSite site = new SPSite(web.Site.ID))
    {
    // implementation details omitted
    }
});

run with elevated permissions

I have written a feature(Site scoped) that adds custom menu items to the New Menu and EditControlBlock of a SharePoint 2007 document library. These menu items should show up only when the user has add and edit permissions for that document library. This works great except for one particular case where the user has only read permission for the parent site but has full control over the document library. In this case the menu items under EditControlBlock show up correctly but the menu items under New menu do not show up. I have set the same rights for all the menu items. 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>


<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

<CustomAction Id="EditMenu1" RegistrationType="FileType" RegistrationId="txt" Location="EditControlBlock" Sequence="106" ImageUrl="/_layouts/images/PPT16.GIF" Title="My Edit Menu" Rights="AddListItems,EditListItems">
    <UrlAction Url="javascript:var surl='{SiteUrl}'; window.location='/test/mypage.aspx?siteurl='+surl+'&amp;itemurl={ItemUrl}&amp;itemid={ItemId}&amp;listid={ListId}&amp;Source='+window.location" />
  </CustomAction>

<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+'&amp;listid={ListId}&amp;Source='+window.location" />
  </CustomAction>
</Elements>

Am I missing anything? Please advice.

Regards, Jagannath