I am trying to read company conference room calendar events using MS Outlook 2013 VBA (MS Exchange).
My script works only with calendars I have permissions for writing, but the conference room shared calendars are read-only.
I get
Runtime error '-2147221233 (8004010f)'
Sub ShowOtherUserCalFolders()
Dim namespace As Outlook.namespace
Dim recipient As Outlook.recipient
Dim CalendarFolder As Outlook.Folder
Set namespace = Application.GetNamespace("MAPI")
Set recipient = namespace.CreateRecipient("calendar-name")
recipient.Resolve
MsgBox recipient.Name
'The name is shown correctly
If recipient.Resolved Then
Set CalendarFolder = namespace.GetSharedDefaultFolder(recipient, olFolderCalendar)
'This should display the calendar on the screen, but it fails
CalendarFolder.Display
Dim oItems As Outlook.Items
Set oItems = CalendarFolder.Items
'The oItems is empty when trying to use read-only calendar
MsgBox oItems.Count
End If
End Sub