0

I add a custom ribbon button but its always disabled. I changed the server area (in the feature) but nothing happens. The code:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
  Id="Ribbon.WikiPageTab.Share.ToPDF"
  Location="CommandUI.Ribbon">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition
         Location="Ribbon.WikiPageTab.Manage.Controls._children">
          <Button
           Id="Ribbon.WikiPageTab.Share.Controls.ToPDF"
           LabelText="Export als PDF"
           Sequence="10"
           Command="test1"
           TemplateAlias="o1"/>
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler 
          Command="test1" 
          CommandAction="javascript:alert('Hello, world');"
          EnabledScript="javascript:function JustReturnTrue() {return true;} JustReturnTrue();"
          />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
</Elements>
  • which browser you are using? – SharePointMan May 20 '16 at 12:25
  • Internet explorer 11 - is a registrationtyp required? – user53651 May 20 '16 at 12:32
  • Only Title is required on the CustomAction element... try adding it. But it would also be a good idea to put in the RegistrationType to "None" – JayHell May 20 '16 at 12:39
  • try using some other browser – SharePointMan May 20 '16 at 12:42
  • The RegistrationType can´t set to "None". Also I add a title but nothing happens. In Google chrome the button is also disabled. – user53651 May 20 '16 at 12:47
1

If you have put that element in the feature which scope is set to "Site", then add another feature, set the scope to "Web", add your button item in this feature, saved, deployed, enabled the new feature from site feature.

UPDATE

Try this below EnabledScript:

EnabledScript="javascript: var JustReturnTrue = function() {return true;}; JustReturnTrue();"

Hope this will help you.

  • The scope ist set to web in the main feature – user53651 May 20 '16 at 12:37
  • Is that work for you? – Dikesh Gandhi May 23 '16 at 6:07
  • I add your command but the button was also disabled. But when I add no Command in the CommandUIDefinition the Button is enabled. Is there a waiting period until the script is published? – user53651 May 23 '16 at 6:41
  • I've tried your given code in my server, it's working properly... – Dikesh Gandhi May 23 '16 at 9:32
  • When I add no command the button is enabled. When the command is "test1" the button is enabled and show the "Hello, World" alert but when I edit (and publish) the script it shows the same alert ("Hello, World"). I don´t understand it. – user53651 May 23 '16 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.