2009-09-30 81 views
0

我知道如何遍歷Outlook中的非重複約會。通過Outlook預約進行迭代

我的問題是,如何迭代通過Outlook約會,包括定期約會?

謝謝。

+0

似乎是一個合理的問題,不知道爲什麼downvote。語法和拼寫不好,但我猜他不是母語的人。編輯清晰。 – 2009-09-30 21:07:13

回答

1

如果你願意使用第三方庫,我建議使用「贖回」庫(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

0

其實沒有必要使用第三方工具。有選項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