通过Outlook预约进行迭代

问题描述:

我知道如何遍历Outlook中的非重复约会。通过Outlook预约进行迭代

我的问题是,如何迭代通过Outlook约会,包括定期约会?

谢谢。

+0

似乎是一个合理的问题,不知道为什么downvote。语法和拼写不好,但我猜他不是母语的人。编辑清晰。 – 2009-09-30 21:07:13

如果你愿意使用第三方库,我建议使用“赎回”库(http://www.dimastr.com/redemption/)。这个库有用RDOFolder2接口与GetActivitiesForTimeRange方法。

在这里您可以找到有关此接口的用法的更多信息: (http://www.dimastr.com/redemption/rdo/rdofolder.htm

如果你不想使用第三方库,需要坚持到Outlook API,关键是要设置IncludeRecurrences在迭代约会之前将标志设置为true。下面的文章应该提供如何做到这一点的足够的信息: (http://www.outlookcode.com/article.aspx?id=30

其实没有必要使用第三方工具。有选项IncludeRecurrences照顾这个:

Set myNameSpace = myOlApp.GetNamespace("MAPI") 
Set MyFolder = myNameSpace.GetDefaultFolder(olFolderCalendar) 

Set oItems = MyFolder.Items 

' Restrict Date 
strFilter = "[Start] >= " + "'" + ourStart + "'" 
Set oItems = oItems.Restrict(strFilter) 

strFilter = "[End] <= " + "'" + ourEnd + "'" 
Set oItems = oItems.Restrict(strFilter) 

' Restrict Category 
strFilter = "[Categories] = " + "'" + ourCategory + "'" 
Set oItems = oItems.Restrict(strFilter) 

oItems.Sort "[Start]" 

' We want recurring, too (http://www.pcreview.co.uk/forums/get-recurring-appointment-dates-vba-t799214.html) 
oItems.IncludeRecurrences = True