0

I am creating a SharePoint Hosted App, Import CSV/XML ribbon button to appear on custom list, so that we can import CSV/XML file data into custom list. Following is my XML for the same. Now my problem is when I deploy this App in Office 365 it works well for Custom Lists that are created after deploying the app. However, Button does not appear on Custom Lists that are there before deploying App.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction Id="78d5618b-ff36-4d87-8bc8-98e0f12225e1.RibbonCustomAction1"
                RegistrationType="List"
                RegistrationId="100"
                Location="CommandUI.Ribbon"
                Sequence="10001"
               Title="Invoke &apos;Import CSV/XML&apos; action">
    <CommandUIExtension>
      <!-- 
      Update the UI definitions below with the controls and the command actions
      that you want to enable for the custom action. HostWebDialog="TRUE"  
                HostWebDialogHeight="420"     
                HostWebDialogWidth="510"
      -->
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.List.Actions.Controls._children">
          <Button Id="Ribbon.List.Actions.RibbonCustomAction1Button"
                  Alt="Import CSV/XML"
                  Sequence="100"
                  Command="Invoke_RibbonCustomAction1ButtonRequest"
                  LabelText="Import CSV/XML"
                  TemplateAlias="o1"
                  Image32by32="_layouts/15/images/placeholder32x32.png"
                  Image16by16="_layouts/15/images/placeholder16x16.png" />
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler Command="Invoke_RibbonCustomAction1ButtonRequest"
                          CommandAction="~appWebUrl/Pages/Default.aspx?{StandardTokens}&amp;SPListId={ListId}"/>
      </CommandUIHandlers>
    </CommandUIExtension >
  </CustomAction>
</Elements>

So please help me in solving this. By above XML Button is visible in "Connect & Export" tab. I also want the button to appear in "Documents Library too".

1 Answer 1

1

I also want the button to appear in "Documents Library too".

For that you have to do some changes in CommandUIDefinitions tag like below:

  <!-- 
  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.ListItem.Actions.Controls._children">
      <Button Id="Ribbon.ListItem.Actions.RibbonCAButton"
              Alt="Import CSV/XML"
              Sequence="100"
              Command="Invoke_RibbonCAButtonRequest"
              LabelText="Import CSV/XML"
              TemplateAlias="o1"
              Image32by32="_layouts/15/images/placeholder32x32.png"
              Image16by16="_layouts/15/images/placeholder16x16.png" />
    </CommandUIDefinition>


    <CommandUIDefinition Location="Ribbon.Documents.Manage.Controls._children">
      <Button Id="Ribbon.Documents.Manage.RibbonCAButton"
              Alt="Import CSV/XML"
              Sequence="100"
              Command="Invoke_RibbonCAButtonRequest"
              LabelText="Import CSV/XML"
              TemplateAlias="o1"
              Image32by32="_layouts/15/images/placeholder32x32.png"
              Image16by16="_layouts/15/images/placeholder16x16.png" />
    </CommandUIDefinition>
  </CommandUIDefinitions>


  <CommandUIHandlers>
    <CommandUIHandler Command="Invoke_RibbonCAButtonRequest"
                      CommandAction="~remoteAppUrl/Pages/default.aspx?{StandardTokens}&amp;ItemId={SelectedItemId}&amp;SPListId={ListId}&amp;ItemUrl={ItemUrl}&amp;SourceUrl={Source}"/>
  </CommandUIHandlers>
</CommandUIExtension >

hope this will help you.

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.