0

I have a working Custom button in the Ribbon but the image is giving me problems. No matter what I set ImageUrl to, it ignores it and if I check the DOM, the src is set to a default image:

src="/_layouts/15/1033/images/formatmap32x32.png"

  <CustomAction
       Location="Microsoft.SharePoint.StandardMenu"
       GroupId="ActionsMenu"
      Title="Generate Response"
      Rights="ManagePermissions"
      Description="Generate a draft response document."
      Sequence="10000"
      RegistrationType="List"
      RegistrationId="11002"
      ImageUrl="/_layouts/15/images/generate32x32.png">
    <UrlAction     Url="~site/_layouts/15/ActionReport.aspx? List={ListId}"/>
  </CustomAction>

Why is my ImageUrl attribute being ignored. What is wrong with my markup?

  • Can you please check permission on your image icon? Please check size of your image icon whether it is 16*16 or not? – Samir Khimani Jan 20 '17 at 17:59
  • The image is deployed to the layouts folder where every authenticated user would have access. Is 16x16 a requirement? I thought 32x32 would work too – Colbs Jan 20 '17 at 19:30
2

In CustomAction element, you are missing CommandUIExtension element which contains elements that extend the user interface.

<CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">
    <!-- Define the (UI) button to be used for this custom action -->
    <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.ListForm.Display.Manage.Controls._children"> 
            <Button Id="{B511A716-54FF-4EAE-9CBE-EA02B51B626E}" 
                    Command="{4E2F5DC0-FE2C-4466-BB2D-3ED0D1917763}" 
                    Image32by32="~site/_layouts/15/images/generate32x32.png" 
                    Image16by16="~site/_layouts/15/images/generate16x16.png" 
                    Sequence="0" 
                    LabelText="Generate Response" 
                    Description="Generate a draft response document." 
                    TemplateAlias="o1" /> 
        </CommandUIDefinition>
    </CommandUIDefinitions>
</CommandUIExtension>

Set location attribute accordingly.

For more information, refer this msdn link.

  • Unfortunately, this didn't work for me. I put your code within a CustomAction block but the same result. Just a blue square where I want the image to be – Colbs Jan 31 '17 at 15:48

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.