How to EnableDisable Ribbon button in Custom Action
How to Enable/Disable Ribbon button in Custom. Action Element base on user’s rights? Lyudmila Zharova Share. Point Developer at MRM Worlwide lzharova 077@gmail. com 12/15/2010
Share. Point 2010 Extensibility Projects can be downloaded from the MSDN Code Gallery here: http: //code. msdn. microsoft. com/vsixforsp and use a new Share. Point Ribbon Project Template Andrew Connel explained how to: -Handle Events in the Share. Point Ribbon http: //www. andrewconnell. com/blog/archive/2010/10/11/handling-events-in-the-sharepoint-ribbon. aspx - Asynchronously check if a command is available in the Share. Point Ribbon: http: //www. andrewconnell. com/blog/archive/2010/10/14/asynchronously-checking-if-a -command-is-available-in-the-sharepoint. aspx To verify if the user has permission on the item level you can use Esma. Script: get_effective. Base. Permissions(). has(SP. Permission. Kind. edit. List. Items)) You can hide the Ribbon from Anonymus users and allow only logged in users with the right permissions to see it by placing SPSecurity. Trimmed. Control on your custom master page.
Open and check-out your master page, find where your ribbon control starts or look for <Web. Part. Pages: SPWeb. Part. Manager id=”m” runat=”Server”/> Place this control below <Sharepoint: SPSecurity. Trimmed. Control runat=”server” Permissions=” Manage. Lists”> Find where your ribbon control ends or look for <div id=s 4 -workspace> and place the closing control above it </Share. Point: SPSecurity. Trimmed. Control> Save, check-in the master page and publish it to see the changes. Set the correct permissions in the Permissions attribute
� How to Enable/Disable Ribbon button in Custom. Action Element base on user’s rights? <Custom. Action … Rights = " Approve. Items " … </Custom. Action> “Rights” attribute is optional Approve. Items - Approve a minor version of a list item or document. According to msdn article http: //msdn. microsoft. com/en-us/library/ms 460194. aspx it specifies a set of rights that the user must have for the link to be visible, for example, "Approve. Items, View. List. Items, Manage. Alerts". If it is not specified, the action always appears in the list of actions. To specify multiple rights, separate the values by using commas. The set of rights are grouped logically according to AND logic, which means that a user must have all the specified rights to see an action. To see all SPBase. Permissions Enumeration follow this link: http: //msdn. microsoft. com/en-us/library/microsoft. sharepoint. spbasepermissions. aspx
- Slides: 7