How to get the emails of the owners of Outlook's shared calendars

I'm using the Interop API to get appointments from Outlook's shared calendars. I can only do this if I know in advance the email of the owner of the shared calendars.

I would like to be able to get the owner's email of each shared calendar before looping appointment's item in the shared calendars. Every contribution is well appreciated.

1 answer

  • answered 2019-11-08 13:58 Eugene Astafiev

    To get a shared calendar folder you need to use the GetSharedDefaultFolder method of the Namespace class which returns a Folder object that represents the specified default folder for the specified user. This method is used in a delegation scenario, where one user has delegated access to another user for one or more of their default folders (for example, their shared Calendar folder). For example:

    Sub ResolveName()  
     Dim myNamespace As Outlook.NameSpace  
     Dim myRecipient As Outlook.Recipient  
     Dim CalendarFolder As Outlook.Folder 
     Set myNamespace = Application.GetNamespace("MAPI")  
     Set myRecipient = myNamespace.CreateRecipient("Eugene Astafiev")  
     If myRecipient.Resolved Then  
     Call ShowCalendar(myNamespace, myRecipient)  
     End If  
    End Sub 
    Sub ShowCalendar(myNamespace, myRecipient)  
     Dim CalendarFolder As Outlook.Folder 
     Set CalendarFolder = _  
     myNamespace.GetSharedDefaultFolder _  
     (myRecipient, olFolderCalendar)  
    End Sub

    The Outlook object model doesn't provide anything for getting a list of shared folders. The best what you can do is to iterate over your address book entries and try to reach shared folders.