I try to add an inline attachment to an appointment through web services for exchange 2010. I followed the steps described in this article (even though it describes email attachments), and it does not work: http://msdn.microsoft.com/en-us/library/hh532564(v=exchg.80).aspx . The attachment IS added to the appointment, but I do not get it to show in the body; I always get an empty space.
This is my code just copying an .jpg attachment from one appointment to another one:
// load the first attachment as stream
MemoryStream stream = new MemoryStream();
FileAttachment fileAttachment = (FileAttachment)appointment.Attachments[0];
fileAttachment.Load(stream);
// create new appointment
Appointment newAppointment = new Appointment(service);
string body = string.Format(@"<html>
<head>
</head>
<body>
<img width=100 height=100 id=""1"" src=""cid:{0}"">
</body>
</html>", "test.jpg");
newAppointment.Body = new MessageBody(BodyType.HTML, body);
// add the attachment to the appointment
byte[] bytes = stream.ToArray();
newAppointment.Attachments.AddFileAttachment("test.jpg", bytes);
newAppointment.Attachments[0].IsInline = true;
newAppointment.Attachments[0].ContentId = "test.jpg";
// save the appointment
FolderId folderId_Calendar = new FolderId(WellKnownFolderName.Calendar, emailAddress);
newAppointment.Save(folderId_Calendar, SendInvitationsMode.SendToNone);
To clarify: I tried the method on email messages, and that works. Just appointments do not.