How do I add an image icon for custom button in outlook

zytham picture zytham · Apr 27, 2012 · Viewed 8.8k times · Source

I have a custom button in outlook and I have to add image icon for the same button.

Ribbon XML is:

<button id="GoToAppConfiguration" 
    label="Application Configuration" 
    getImage="GetCustomImage" 
    onAction="GoToAppConfigurationClicked" 
    size="normal" />

I want to write ribbon callback method but how do I write the same and how do I use an image stored in a Resource folder under the Addin project.

Answer

SliverNinja - MSFT picture SliverNinja - MSFT · Apr 27, 2012

You just need to return a Bitmap from GetCustomImage. Here is a c# example, assuming you have added the BMP to your Project Resources.

public Bitmap GetCustomImage(Office.IRibbonControl control)
{
    return Properties.Resources.btnAppConfiguration_Image; // resource Bitmap
}