Outlook 2016 从企业保管库检索电子邮件附件

问题描述 投票:0回答:1

我通过使用获得了电子邮件对象和附件

Mail.attachments.count,但存档的电子邮件无法正常工作,因为它正在使用 Enterprise Vault。

我收到附件,但存档电子邮件无法正常工作并给出 0 或 1 计数

c# outlook-addin enterprise
1个回答
0
投票

我浏览了电子邮件正文,发现当电子邮件存档时,附件会以如下两种方式显示。

第一

<<Attachments data>>

第二次

Attachments:
Attachments data

为了获取附件,可以使用以下逻辑:

    iStartIndex = strEmailBody.LastIndexOf("<<") + 2;

    iLastIndex = strEmailBody.LastIndexOf(">>") - 2;
    string strAttachmentsData = strEmailBody.Substring(iStartIndex, iLastIndex - iStartIndex);
    var regexObj = new Regex(@".*\)");
    var allMatchResults = regexObj.Matches(strAttachmentsData);
}
else if(strEmailBody != null &&  strEmailBody.LastIndexOf("Attachments:")!=-1)
{
    iStartIndex = strEmailBody.LastIndexOf("Attachments:") + 12;                                    
    string strAttachmentsData = strEmailBody.Substring(iStartIndex, strEmailBody.Length - iStartIndex-1);
    MatchCollection allMatchResults = null;
    var regexObj = new Regex(@".*\)");
    allMatchResults = regexObj.Matches(strAttachmentsData);
}
© www.soinside.com 2019 - 2024. All rights reserved.