如何根据用户权限显示习惯菜单项

Joh*_*sen 4 sharepoint sharepoint-2007

我有一个CustomAction menuItem

    <CustomAction Id="DocumentManagement.DocLibNewToolbar" Location="EditControlBlock" RegistrationType="ContentType" RegistrationId="0x0101002bae451fbd3640fb9bae5df410b4a9a0" Title="Print">
        <UrlAction Url="~site/_layouts/ELSActionMenu/PrintListItem.aspx?List={ListId}&amp;ID={ItemId}"/>
  </CustomAction>
Run Code Online (Sandbox Code Playgroud)

我知道我可以编写一个SPItemEventReceiver类,并检查当前用户角色是否符合条件.但是我想在ListItem上隐藏这个CustomAction ["授权"] = TRUE,这可能吗?

Kus*_*sek 7

根据我理解的问题的标题,您需要根据权限显示自定义操作.有几种方法可以做到这一点,自定义操作标记有一个名为Rights的属性,可以占用SharePoint所拥有的33个内置权限中的任何一个.有关更多详细信息,请参阅本文.否则,您可以创建一个自定义类,以决定何时根据自定义逻辑显示菜单项.请参阅文章.