2
使用EWS Managed API在C#中工作時,我們無法高效地檢索以內聯附件存儲的圖像。EWS + Exchange 2007:檢索內嵌圖像
端點將在面板中顯示帶有內嵌圖像的電子郵件作爲完整形成的html頁面。代碼我們目前我們:
string sHTMLCOntent = item.Body;
FileAttachment[] attachments = null;
if (item.Attachments.Count != 0)
{
attachments = new FileAttachment[item.Attachments.Count];
for (int i = 0; i < item.Attachments.Count; i++)
{
string sType = item.Attachments[i].ContentType.ToLower();
if (sType.Contains("image"))
{
attachments[i] = (FileAttachment)item.Attachments[i];
string sID = attachments[i].ContentId;
sType = sType.Replace("image/", "");
string sFilename = sID + "." + sType;
string sPathPlusFilename = Directory.GetCurrentDirectory() + "\\" + sFilename;
attachments[i].Load(sFilename);
string oldString = "cid:" + sID;
sHTMLCOntent = sHTMLCOntent.Replace(oldString, sPathPlusFilename);
}
}
}
..這是不是很有效,但並放慢我們的web應用程序的響應能力。有沒有人有這個問題的更好的解決方案?我們使用的是Exchange 2007 SP1,因此IsInline屬性只能用作其Exchange 2010。