在文档库中添加自定义菜单项时出现SharePoint问题

Jag*_*ath 5 sharepoint menu sharepoint-2007

我编写了一个功能(站点作用域),它将自定义菜单项添加到SharePoint 2007文档库的"新建菜单"和"EditControlBlock"中.仅当用户添加和编辑该文档库的权限时,才会显示这些菜单项.除了用户只具有父站点的读取权限但完全控制文档库的一种特殊情况之外,这种方法很有效.在这种情况下,EditControlBlock下的菜单项会正确显示,但新菜单下的菜单项不会显示.我为所有菜单项设置了相同的权限.以下是功能和元素清单文件中的示例条目

<?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>
Run Code Online (Sandbox Code Playgroud)

我错过了什么吗?请指教.

此致,Jagannath

iro*_*man -1

您可能需要尝试提升他们在代码中的权限。

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

以提升的权限运行