【发布时间】:2018-02-12 01:36:09
【问题描述】:
我正在为我的软件使用 Outlook 对象模型(互操作)。
在我发送电子邮件之前,我会获取并保留我们创建的电子邮件的 PR_SEARCH_KEY。
如果我想使用 PR_SEARCH_KEY 在已发送文件夹中查找电子邮件,如何在 c# 中使用 Office.Interop(不是 EWS 或不兑换)来做到这一点?
我试图从 SentFolder.Items.Find(filter) 中找到它。但它不起作用,因为 PR_SEARCH_KEY 是二进制的。
谢谢!
public Outlook.MailItem FindEmailFromSentFolder(string emailId)
{
try
{
if (_sentFolderItems == null)
return null;
// find the sent mail from sent folder based on PR_Serach_Key
var filter = string.Format("@SQL=\"http://schemas.microsoft.com/mapi/proptag/0x300B0102\" = '{0}'",
emailId);
var item = _sentFolderItems.Find(filter);
if (item != null && item is Outlook.MailItem)
return item as Outlook.MailItem;
}
catch (Exception ex)
{
return null;
}
return null;
}
【问题讨论】:
标签: outlook interop office-interop