I'm working on a Outlook add-in that's converts attachments. When trying to convert an Tiff attachment to a Bitmap I get:
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException. Oveloaded method System.Windows.Media.Imaging.TiffBitmapDecoder.TiffBitmapDecoder has invallid arguments.
The code:
const string PR_ATTACH_DATA_BIN = "http://schemas.microsoft.com/mapi/proptag/0x37010102";
// Retrieve the attachment as a byte array
var attachmentData = myOutlookAttachement.PropertyAccessor.GetProperty(PR_ATTACH_DATA_BIN);
TiffBitmapDecoder decoder = new TiffBitmapDecoder(attachmentData, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapSource bitmapSource = decoder.Frames[0];
Bitmap bmp = new Bitmap(bitmapSource.PixelWidth, bitmapSource.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);