.NET: Get all Outlook calendar items

前端 未结 11 1346
情书的邮戳
情书的邮戳 2020-12-02 09:41

How can I get all items from a specific calendar (for a specific date). Lets say for instance that I have a calendar with a recurring item every Monday evening. When I requ

11条回答
  •  半阙折子戏
    2020-12-02 10:00

    There is no need to expand recurring items manually. Just ensure you sort the items before using IncludeRecurrences.

    Here is VBA example:

    tdystart = VBA.Format(#8/1/2012#, "Short Date")
    tdyend = VBA.Format(#8/31/2012#, "Short Date")
    
    Dim folder As MAPIFolder
    Set appointments = folder.Items
    
    appointments.Sort "[Start]" ' <-- !!! Sort is a MUST
    appointments.IncludeRecurrences = True ' <-- This will expand reccurent items
    
    Set app = appointments.Find("[Start] >= """ & tdystart & """ and [Start] <= """ & tdyend & """")
    
    While TypeName(app) <> "Nothing"
       MsgBox app.Start & " " & app.Subject
       Set app = appointments.FindNext
    Wend
    

提交回复
热议问题