- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有一个 outlook VSTO 插件,我可以使用以下代码检索日历约会列表:
private Items GetAppointmentsInRange(Folder folder, DateTime startTime, DateTime endTime)
{
string filter = "[Start] >= '"
+ startTime.ToString("g")
+ "' AND [End] <= '"
+ endTime.ToString("g") + "'";
Debug.WriteLine(filter);
try
{
Items calItems = folder.Items;
calItems.IncludeRecurrences = true;
calItems.Sort("[Start]", Type.Missing);
Items restrictItems = calItems.Restrict(filter);
if (restrictItems.Count > 0)
{
return restrictItems;
}
else
{
return null;
}
}
catch
{
return null;
}
}
我可以遍历此约会项目并获取我被告知的 entryId 是该系列的唯一标识符。
我现在试图弄清楚,给定一个 EntryId,什么是直接引用 appointmentItem 系列的正确代码(无需搜索所有内容并在“客户端”进行过滤
这在 outlook vsto 中可能吗?
最佳答案
如果你想通过EntryID
获取项目(MailItem
, FolderItem
, AppoinmentItem
, ...) ,您需要使用 GetItemFromID()
,此方法返回由指定条目 ID(如果有效)标识的 Microsoft Outlook 项目。
此函数在 NameSpace
对象中可用,您可以使用 Application.Session
属性或 app.GetNamespace("MAPI")
获取它调用:
var app = new Microsoft.Office.Interop.Outlook.Application();
...
var ns = app.Session; // or app.GetNamespace("MAPI");
var entryID = "<apppoinment entry id>";
var appoinment = ns.GetItemFromID(entryID) as AppointmentItem;
但建议提供文件夹的Id:
var entryID = "<apppoinment entry id>";
var storeID = "<folder store id>";
var appoinment = ns.GetItemFromID(entryID, store) as AppointmentItem;
请注意,如果您将商品移至另一家商店,EntryID
可能会发生变化。
此外,Microsoft 建议解决方案不应依赖于唯一的 EntryID
属性,除非项目不会被移动,例如,如果您调用 Respond()
方法olMeetingAccepted
或 olMeetingTentative
创建一个具有不同 EntryID
的新约会项目,并删除原来的。
关于c# - 在 Outlook C# VSTO 中,如何在给定 EntryId 等的情况下获取对 appointmentItem 的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34516203/
摘要 我正在尝试添加指向从已移至另一个文件夹的电子邮件创建的任务的超链接。 目标是让任务包含指向已移至“已处理电子邮件”文件夹的 Outlook 项目的超链接。 问题 我不明白如何移动 MailIte
我正在开发将 Outlook 中的 MailItem(我知道它是 MailItem 而不是任何其他类型)拖放到 Access 备忘录字段中的功能。尝试对 MailItem 对象调用 SaveAs。 我
我的公司使用一个电子邮件地址供客户发送请求和订单。我们创建了一个将电子邮件导入表的 Access 数据库。该表为每个导入的电子邮件创建它自己的唯一标识符,但不应两次导入电子邮件。该系统正在运行,因为我
如何通过 EntryID 使用 C# VSTO Outlook 2007 插件打开联系人。 现在我正在查找联系人文件夹中的所有联系人: string entryid = ... Outlook.App
在 Exchange 2007 SP3 上将 RDO 4.8.0.1184 与 Delphi 2006 结合使用 我有以下代码(缩写): Msg := MailSession.GetMessageFr
注意:我使用的是 VBA 和 Office 2007。(我会使用 C#,但项目参数不允许这样做) 我正在尝试在 Outlook 或 API 中找到某种方法,使我能够通过提供 Access 数据库中的
是否有官方支持的方法来转换 Outlook 中的项目 ID REST API成MAPI条目 ID? 我说的是为 http GET 的 json 响应中的项目返回的“Id”字段。在邮箱端点上,如下所示:
我有一个 outlook VSTO 插件,我可以使用以下代码检索日历约会列表: private Items GetAppointmentsInRange(Folder folder, Date
如果我有一个 mapifolder 的 storeid,通过文件夹选择器从 outlook interop 库中选择,我有没有办法获得该文件夹的 smtpaddress? 我知道它在扩展属性中,但我希
如果我有一个 mapifolder 的 storeid,通过文件夹选择器从 outlook interop 库中选择,我有没有办法获得该文件夹的 smtpaddress? 我知道它在扩展属性中,但我希
我是一名优秀的程序员,十分优秀!