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。