0

I'm trying to fetch events from a shared calendar. I have tried the solutions provided in the following link: Read Outlook Events via Python

However, this only reads MAPI and I want to read from a REST calendar.

Here's the calendar properties enter image description here

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
ahassona
  • 41
  • 4

1 Answers1

0

In the post you mentioned the default calendar is used:

appointments = namespace.GetDefaultFolder(9).Items 

It seems you need to choose another calendar in Outlook. You can find the required folder by using navigation modules and folders in Outlook. The NavigationFolder.Folder returns a Folder object that represents the shared or linked folder associated with the navigation folder. For example, here is a sample VBA code which shows how to get to the required folder:

Sub PrintAllSharedCalendars()
    Dim olPane As NavigationPane
    Dim olMod As CalendarModule
    Dim olGrp As NavigationGroup
    Dim olNavFld As NavigationFolder
    Dim olCalFld As Folder
    
    Set Application.ActiveExplorer.CurrentFolder = Session.GetDefaultFolder(olFolderCalendar)
    Set olCalFld = Session.GetDefaultFolder(olFolderCalendar)
    Set olPane = Application.ActiveExplorer.NavigationPane
    Set olMod = olPane.Modules.GetNavigationModule(olModuleCalendar)
    Set olGrp = olMod.NavigationGroups.Item("Shared Calendars")
   
    For i = 1 To olGrp.NavigationFolders.Count
        Set olNavFld = olGrp.NavigationFolders.Item(i)
        Debug.Print(olNavFld.Folder.Name)
    Next

End Sub

The Outlook object model is common for all kind of applications. So, I hope you can easily find the required sequence of property and method calls to get it it running in python.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45