سؤال

I am trying to add a custom pwa ribbon button, I am using the project server sample element.xml to add the button, the button does show up in the ribbon, but it is always disabled.

The customization Xml is :

    <?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction Id="239da314-4999-458f-9612-623a13abc3c8.RibbonQuickStatus"
                Location="CommandUI.Ribbon">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.ContextualTabs.ProjectCenter.Home.Editing.Controls._children">
          <Button Id="Ribbon.ContextualTabs.MyWork.Home.Page.QuickStatus"
                  Alt="Quick Status app"
                  Sequence="30"
                  Command="Invoke_RibbonQuickStatusButtonRequest"
                  LabelText="Quick Status"
                  TemplateAlias="o1"
                  Image16by16="_layouts/15/1033/images/ps16x16.png"
                  Image16by16Left="-80"
                  Image16by16Top="-144"
                  Image32by32="_layouts/15/1033/images/ps32x32.png"
                  Image32by32Left="-32"
                  Image32by32Top="-288"
                  ToolTipTitle="QuickStatus"
                  ToolTipDescription="Run the QuickStatus app" />
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler Command="Invoke_RibbonQuickStatusButtonRequest"
                          CommandAction="~appWebUrl/Pages/Default.aspx?{StandardTokens}"/>
      </CommandUIHandlers>
    </CommandUIExtension >
  </CustomAction>
</Elements>

The result is like so:

enter image description here

I have even tried the EnabledScript property and set a JavaScript function to return true, that doesn't help either, which is why I omitted it out the customizations xml, not specifying the node means it would always be enabled.

هل كانت مفيدة؟

المحلول

To answer my own question, each time the ribbon button customization xml is changed and published, do an IISReset and clear the browser cache, that should fix the issue and the button should be enabled.

نصائح أخرى

I have been facing similar issue. The XML which was working fine was also causing same issue.

IIS reset did not help.

I was using Chrome, switching to IE fixed the issue. Also, when switched to Chrome Incognito Window, it fixed. enter image description here

So, browser cache could be cause of issue.

Solution 2

Since, I came to know it is just browser cache issue, I thought Minimal Download Strategy could be causing issue, so deactivating that feature from site ( Web ) it fixed issue.

O365 is very strange. Not only do javascript: URLs not work for custom actions, also EnabledScript is not supported.

I ran into the disabled-bug, it turns out it must be some user-scoped caching mechanism, not sure whether server or clientside. Whenever I change commands or handler URLs and deploy again, the button is deactivated and the handler URL is still the old one.

Only when I open a new private browser session (ctrl-shift-p) and log in again, the cache is being renewed (also works in the previous browser window) and the commands work and show the right URLs.

Another big issue is missing tokens such as {ListId}, whenever {SelectedListId} is just "null", e.g. on form pages, making it impossible to pass the context for the command. One cannot do anything properly with O365, one big mess.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى sharepoint.stackexchange
scroll top