Sharepoint 2010 - Enable/Disable Ribbon Button with EcmaScript
I show you a detailed example of how to enable and disable a ribbon button according to the current user’s group. The example uses “EnabledScript” attribute of the CommandUIHandler of the ribbon button. Then the EnabledScript is built with EcmaScript to find groups and user info. Lets Start with creating a Ribbon button first. 1. Create a empty project. 2. Deploy it as a Farm solution. 3. Right click on the feature and click “Add feature”. 4. Right click on the project and add a new “Empty Element” item. 5. Next add the below code to add a custom Ribbon button to your document library. <Elements xmlns=”http://schemas.microsoft.com/sharepoint/” > <CustomAction Id=”ButtonForGroupUsersOnly” Location=”CommandUI.Ribbon” RegistrationId=”101″ RegistrationType=”List” Title=”Owners Group Button”> <CommandUIExtension> <CommandUIDefinitions> <CommandUIDefinition Location=”Ribbon.Library.ViewFormat.Controls._children”> <Button Id=”Ribbon.L...