使用EWS和Exchange 2007通过对话实现Outlook 2010的组
我们正在使用EWS在我们的某些邮箱上生成一些分析。
部分原因是获得对话的计数/名称/开始/结束。 对话类似于Outlook 2010在按对话分组时显示的方式。
我希望能够使用ConversationId对项目进行分组,但这似乎只是Exchange 2010的一项function。
我可以按文件夹中的主题进行分组以获得线程的简单概念…但是这不会处理拆分对话,因为Outlook 2010会这样做 – 具体而言,它不会处理引入已发送项目中的回复(这些对我们来说很重要 – 如果不看回复,我们就无法获得好的指标。
我目前获取线程信息的代码如下所示:
private IEnumerable 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]:电子邮件对象协议规范 ,第2.2.1.2节和第2.2.1.3节。
属性本身在[MS-OXPROPS]:Exchange Server协议主属性列表中定义 。
上述就是C#学习教程:使用EWS和Exchange 2007通过对话实现Outlook 2010的组分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请点击右边联系管理员删除。
如若转载,请注明出处:https://www.ctvol.com/cdevelopment/992740.html