6

I am deploying custom ribbon button using SharePoint provider hosted app. It creates ribbon button without any issues when I deploy to the site manually (app scope). But it does not create a ribbon button when app is pushed through app catalog site to all sites (tenant scope). I have read on MSDN site that it is not possible. Any workaround to this?

Here is the xml of ribbon control.

    <?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction Id="33080663-4c4a-457f-aae5-d2185039bdb5.RibbonCustomAction_ConvertPDF"
                RegistrationType="ContentType"
                RegistrationId="0x0101"
                Location="CommandUI.Ribbon"
                Sequence="10001"
                Title="Convert to PDF">
    <CommandUIExtension>
      <!-- 
      Update the UI definitions below with the controls and the command actions
      that you want to enable for the custom action.
      -->
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.Documents.Copies.Controls._children">
          <Button Id="Ribbon.Documents.Copies.RibbonCustomAction_ConvertPDFButton"
                  Alt="Convert to PDF"
                  Sequence="11"
                  Command="Invoke_RibbonCustomAction_ConvertPDFButtonRequest"
                  LabelText="Convert to PDF"
                  TemplateAlias="o1" CommandType="OptionSelection"
                  Image32by32="~remoteAppUrl/Images/pdf32.gif"
                  Image16by16="~remoteAppUrl/Images/pdf16.gif" />
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler Command="Invoke_RibbonCustomAction_ConvertPDFButtonRequest"
                          CommandAction="~remoteAppUrl/Pages/Default.aspx?{StandardTokens}&amp;Action=pdf&amp;ListId={SelectedListId}&amp;ItemId={SelectedItemId}&amp;BookmarkField=Title&amp;SortField=Modified&amp;SortOrder=ascending&amp;Source={Source}"
                          EnabledScript="javascript:function multiEnable() {  var items = SP.ListOperation.Selection.getSelectedItems(); return (items.length > 0); } multiEnable();" />
      </CommandUIHandlers>
    </CommandUIExtension >
  </CustomAction>
</Elements>

1 Answer 1

2

Custom Actions are not supported for tenant-scoped apps (Look at the section "Limitations of Tenant-scoped apps").

One workaround to consider would be to add the Custom Action in code via the app installed event. Check out this sample, which runs in a page but you could use the same approach in an app installed event.

1
  • I tried it already. App installed event does not trigger on individual sites when app installed using tenancy scope. It triggered only on app catalog site. Feb 3, 2015 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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