簡體   English   中英

EWS(Exchange Web服務)-向約會添加內聯附件

[英]EWS (Exchange Web Services) - Add inline attachment to appointment

我嘗試通過Web服務為Exchange 2010向約會添加內聯附件。我遵循了本文中描述的步驟(即使它描述了電子郵件附件),但它不起作用: http : //msdn.microsoft.com/ zh-cn / library / hh532564(v = exchg.80).aspx 附件已添加到約會中,但我看不到它在正文中顯示; 我總是有一個空白。

這是我的代碼,只是將.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);

澄清一下:我嘗試了電子郵件方法,並且行得通。 只是約會而已。

根據此示例,您還應該設置HasAttachments屬性。

http://www.independentsoft.de/exchangewebservices/tutorial/createinlineattachment.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM