2013-10-08 81 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時似乎有限制。不幸的是,我不再在這個項目上工作,所以在這方面沒有關於這個問題的更新。 –

回答

相關問題