【发布时间】:2015-12-29 17:46:36
【问题描述】:
我有一个 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,什么是直接引用约会项目系列的正确代码(无需搜索所有内容并在“客户端”进行过滤
这在 Outlook vsto 中可能吗?
【问题讨论】:
-
是否需要将EntryID存储在数据库中以备后用?或者您只是在会话期间需要它?
-
@YacoubMassad - 我正在存储 EntryId(但老实说,我看不出这会对我的问题给出不同的答案)
-
EntryID 有不同的类型,有的可以跨越不同的会话,有的只能跨越一个会话
-
你会像这样使用它
Application.GetNamespace("MAPI").GetItemFromID(entryIDForAppointment, EntryIdForStore)。商店是您正在处理的邮箱。如果邮箱里有文件夹,可以使用folder.StoreID获取店铺的入口id。