2013-10-08 65 views
1

我尝试通过用于Exchange 2010的Web服务向约会添加内联附件。我遵循本文中描述的步骤(即使它描述了电子邮件附件),并且它不起作用:http://msdn.microsoft.com/en-us/library/hh532564(v=exchg.80).aspx。 附件是添加到约会,但我不明白它在身体上显示;我总是得到一个空的空间。EWS(Exchange Web服务) - 将内联附件添加到约会

这是我的代码只是复制从一个约会的.JPG附着到另一个问题:

// 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); 

为了澄清:我想对电子邮件的方法,以及作品。只是约会不。

+0

我这个在微软论坛讨论:http://social.msdn.microsoft.com/Forums/exchange/en-US/36a2cdce-9ec6-4e63-9252-e5fce9ccff9c/ews-exchange -web-services-add-inline-attachment-to-appointment?forum = exchangevrdevelopment#76f963d6-a730-4d73-b93a-4cb9ba9443d6 –

+0

现在解决了吗?是的,如何 –

+0

不,不是。看看我之前提到的关于社交MSDN的讨论。使用HTML时似乎有限制。不幸的是,我不再在这个项目上工作,所以在这方面没有关于这个问题的更新。 –

回答

相关问题