'Programmatically adding an Exchange Online mailbox to Outlook

Does Redemption support adding an Exchange Online mailbox to Outlook? I know this can be done for a .pst using NameSpace.AddStoreEx, but can Redemption handle an Exchange Online store?

My goal is to turn off Outlook automapping and programmatically add Exchange Online mailboxes based on delegated permissions.

Thanks.



Solution 1:[1]

Yes, Redemption exposes RDOSession.Stores.AddDelegateExchangeMailBoxStore - note that it needs to be able to retrieve the autodiscover XML of that mailbox. It needs to either be cached, or used alongside RDOSession.LogonHostedExhangeMailbox (which takes explicit credentials) or the parent RDOSession object must be used inside the outlook.exe address space (e.g. from a COM addin or Outlook VBA) - this way Redemption can intercept Outlook credentials.

Solution 2:[2]

It sounds like you are interested in the NameSpace.GetSharedDefaultFolder method 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 or any other standard 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("Dan Wilson") 
 myRecipient.Resolve 
 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) 
 CalendarFolder.Display 
End Sub

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitry Streblechenko
Solution 2 Eugene Astafiev