Outlook AppointmentItem - How do I programmatically add RTF to its Body?

Posted by Stuart Harris on Stack Overflow See other posts from Stack Overflow or by Stuart Harris
Published on 2009-02-17T00:33:04Z Indexed on 2012/10/01 3:38 UTC
Read the original article Hit count: 218

Filed under:

I would like to set the Body of an AppointmentItem to a string of RTF that contains an embedded image. Setting Microsoft.Office.Interop.Outlook.AppointmentItem.Body results in the RTF appearing as-is in the appointment.

I have tried using Redemption which wraps the appointment and exposes an RTFBody property, but the RTF formatting (including the image) is lost.

In this example (which doesn't have an embedded image) the RTF appears in the document as-is. Has anyone managed to do this?

var appointment = (AppointmentItem)app.CreateItem(OlItemType.olAppointmentItem);
appointment.Subject = "test subject";
appointment.Start = DateTime.Now;
appointment.End = DateTime.Now.AddHours(1);
appointment.Body = @"{\rtf1\ansi\deff0{\fonttbl{\f0 Arial;}}{\colortbl ;\red0\green0\blue255;}\pard\cf1\f0\fs24 Test}";
appointment.Save();

© Stack Overflow or respective owner

Related posts about outlook