gpt4 book ai didi

c# - 使用 EWS 和 Exchange 2007 通过 session 实现 Outlook 2010 的组

转载 作者:太空狗 更新时间:2023-10-29 23:33:57 25 4
gpt4 key购买 nike

我们正在使用 EWS 对我们的一些邮箱生成一些分析。

其中一部分是获取对话的计数/名称/开始/结束。对话类似于 Outlook 2010 按对话分组时显示它们的方式。

我希望能够使用 ConversationId 对项目进行分组,但这似乎是 Exchange 2010 独有的功能。

我可以在一个文件夹中按主题分组以获得线程的简单概念......但是这不能像 Outlook 2010 那样处理拆分对话 - 具体来说,它不能处理引入已发送的回复项目(这些对我们很重要 - 如果不查看回复,我们就无法获得好的指标)。

我当前获取线程信息的代码如下所示:

private IEnumerable<EmailThread> GetThreads(Folder folder)
{
var view = new ItemView(int.MaxValue) {PropertySet = new PropertySet(BasePropertySet.IdOnly)};

// view.PropertySet.Add(ItemSchema.ConversationId); - Can't use this as we're stuck on Exchange 2007 !!!
view.PropertySet.Add(ItemSchema.Subject);
view.PropertySet.Add(ItemSchema.DateTimeReceived);

var grouping = new Grouping(ItemSchema.Subject, SortDirection.Descending, ItemSchema.DateTimeReceived, AggregateType.Maximum);
var groupResults = folder.FindItems(view, grouping);


return groupResults.Select(x => new EmailThread
{
Name = x.Items.First().Subject,
Items = x.Items.Count,
StartDate = x.Items.Last().DateTimeReceived, // Assume last in thread is first email
EndDate = x.Items.First().DateTimeReceived // Assume first in thread is most recent
});
}

我希望有人知道一种巧妙的方法来有效地获取有关构成对话一部分的回复的信息?

最佳答案

您可以通过扩展属性获取 ConversationId 和 ConversationIndex:

private static readonly ExtendedPropertyDefinition ConversationIdProperty = new ExtendedPropertyDefinition(0x3013, MapiPropertyType.Binary);
private static readonly ExtendedPropertyDefinition ConversationIndexProperty = new ExtendedPropertyDefinition(0x0071, MapiPropertyType.Binary);

var items = service.FindItems(WellKnownFolderName.Inbox, new ItemView(512) { PropertySet = new PropertySet(BasePropertySet.FirstClassProperties,
ConversationIdProperty, ConversationIndexProperty)});

两者都是二进制属性。他们的内容在这里有非常详细的描述:

[MS-OXOMSG]: E-Mail Object Protocol Specification , 第 2.2.1.2 和 2.2.1.3 节。

属性本身在 [MS-OXPROPS]: Exchange Server Protocols Master Property List 中定义.

关于c# - 使用 EWS 和 Exchange 2007 通过 session 实现 Outlook 2010 的组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7487570/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com