0
votes

I developed an app for our client that would process emails stored in Public Folders.

The Public Folders were hosted in an on-premise Exchange Server. The app ran on a Scheduled Task as Administrator.

The Administrator account had an Outlook Profile.

The app would login using rdoSession.Logon and use rdoSession.Stores.FindExchangePublicFoldersStore to access the Public Folders.

The exchange has now been migrated to Office 365 and the app now has to run on a VM in Azure.

The app no longer runs as Administrator but is run as NETWORK SERVICE. This is something I have no control over.

As this account doesn't have an Outlook Profile I want to be able to login to an Exchange account to access the Public Folders.

We use O365 so I can test the functionality locally. If I run the app in my account it works, as expected.

In an attempt to connect to Exchange without using the default profile I tried using:

rdoSession.LogonHostedExchangeMailbox("smtp.office365.com", "myAccount","myPassword")

This was fine and I was able to login. When I called rdoSession.Stores.FindExchangePublicFoldersStore I get the error "Could not find the Public Folder store".

Is there a way to login to O365 Exchange with a specific account, without using the user's profile the app is run as, and access the Public Folders?

1

1 Answers

0
votes

Since Public Folders are no longer a required component, MSEMS provider does not assume that the PF store is even present. Instead, it asynchronously adds it later when (based on autodiscover XML) it realizes that the PF store is available. There is no way to force the MSEMS provider to perform that check and add the store on demand.

Try to create a fixed Outlook profile in the online mode on that machine and use that profile to call RDOSession.Logon. The profile would need to be created while you are locally logged in as the user who will run the service.