office365outlook-addinoutlook-redemption

RDOOutOfOfficeAssistant object does not work with Outlook 365


I wrote a VSTO add-in for outlook. I am in a Microsoft Exchange environment in my company. I use the RDOOutOfOfficeAssistant object to set an OOF message (StartTime, OutOfOfficeTextInternal, ...). Everything works fine on my PC with MS Outlook 2013 32-bit. When I deploy the add-in to MS Outlook 365 MSO 32-bit machines, the part that uses the RDOOutOfOfficeAssistant object doesn't work. When I monitor the program part with a (Visual Basic) Try - Catch, I get an error message "EWS is not available: HTTP error 401 from https://outlook.office365.com/EWS/Exchange.asmx".

I'm unsure if I need the Session.Credentials.Add ... line from the example

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
Session.Credentials.Add "*.myserver.com", "Domain\UserName", "MyPassword"
set OofAssistant = Session.Stores.DefaultStore.OutOfOfficeAssistant
OofAssistant.BeginUpdate

at https://dimastr.com/redemption/RDOOutOfOfficeAssistant.htm. I commented it out for now. Do I have to enter the login data of the currently logged in user here? How do I do that if I distribute the one add-in to over 100 users. Every user has different login data?!?

I would expect the add-in to work on Outlook 365 as well. So it works on outlook 2013, I think, EWS is available on the exchange server.


Solution

  • Office 365 no longer uses basic authentication, and there is no easy way to generate OAuth tokens unless you register you app in Azure.

    Redemption, when running inside the outlook.exe address space, can intercept and reuse OAuth tokens used by Outlook itself when it performs its own EWS calls.

    Create an instance of the RDOSession object ahead of time (e.g., when your addin starts up) to give it time to cache the tokens and comment out the Session.Credentials.Add line when you later use the OutOfOfficeAssistant object.