tags:

views:

1174

answers:

1

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();
A: 

Start setting BodyFormat property before setting the Body.

"http://msdn.microsoft.com/en-us/library/aa211430(office.11).aspx"

shahkalpesh
The BodyFormat property is not available on AppointmentItem. They are different to mailItems and don't support HTML (only text + RTF). Thanks for your help though.
Stuart Harris