Search code examples
c#vstooutlook-addinribbon-control

Proper signature for VSTO's Button.GetImage


I have created a working add-in for Outlook and now I try to add an image to a button. I've seen in many questions that you need to set the getImage="GetImage" property and provide a callback function for it, so I did:

public Bitmap GetImage(IRibbonControl ribbon)

However, with this method the add-in doesn't even load. I tried a couple of other signatures like

public stdole.IPictureDisp GetImage(Microsoft.Office.Core.IRibbonControl ribbon)
public Bitmap GetImage(Microsoft.Office.Core.IRibbonControl control)
public stdole.IPictureDisp GetImage(string idMso, int Width, int Height)

but none of them worked. What is the correct signature of this function?


Solution

  • I got it and I post a self-answer, maybe it helps someone someday...

    In order to use the getImage callback you must not set the image property. It's either or.