如何将以下所有(Outlook.Items.Find)结果存储/投射到IEnumerable对象中?*展望16.0
Outlook.MailItem emailResults = null;
emailResults = mailItems.Find($"[Categories] = 'Important'");
我正在尝试以下方法,但均未成功。
application = Marshal.GetActiveObject("Outlook.Application") as Outlook.Application;
nameSpace = application.GetNamespace("mapi");
inbox = nameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
mailItems = inbox.Items;
IEnumerable<Outlook.MailItem> emailResults = null;
emailResults = (IEnumerable<Outlook.MailItem>)mailItems.Find($"[Categories] = 'Important'");
我正在尝试看中而不是遍历每个结果。感谢您提前提出任何建议。
用途Items.Restrict
-返回可枚举的Items
集合。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句