Exchange in Office 365 environment

Trying to connect to our Exchange-server. I want to use the “Get Exchange Mail Messages”-activity to access online mail-accounts in our hybrid configuration; fail to do so.

Having a tough time finding updated documentation and I wonder if any other has had luck connecting.

Are there any stuff to be done in Azure? Can someone explain what ApplicationID and DirectoryID is and where to find it if I don’t need to create a set of my own. Are some properties mutual exclusive and so on.

Any help appreciated.

Hi @HenrikCarlsen
Under normal circumstances, you wouldn’t need to use the Azure AD Identity and Access Management activities pack.

In Get Exchange Mail Messages activity, you just need to provide the exchange properties. Even better if your company’s exchange server has autodiscover enabled (which usually is the case)
The EmailAutodiscover option in the activity will help you configure everything based on the email address used.

Have you faced any specific issues in setting this up?

Hi Cata (Ash), thanks for the quick response.

The AutoDiscover is disabled.

For server I enter “”. I have seen examples where some asmx-page is referenced. Tried that too with no luck.

I need to access the online Exchange and I have no idea that filling out the “Office 365 set-tings”-section sends me there or if it is enough with “https:// outlook…”. If I omit the 365-section and only fill out the “Logon”-section I expect it tries to access the local exchange (as mentioned we’re running hybrid and want to access the online one). If I enter my credentials, I get a 401, auth. error. That is with my privileged account, it ought to work. Log shows no sign of logon attempts and the error messages does not guide on how to solve the issue.

Does the “Logon”- and 365-sections exclude or supplement each other.

Generally, I would really like documentation to be updated and the including of a running demo.

The Office 365 Graph API is a great way (and recommended by Microsoft for future projects) to implement authentication in UiPath projects.
The ApplicationID and DirectoryID can be set up by going to Azure Active Directory in your Azure portal. A complete step-by-step guide is available here:

As far as my (limited) knowledge goes, Microsoft have already moved to (or shortly about to) decommission the exchange authentication, which means there may not be future updates or support. The asmx method might go out of support soon.
Read this blog post for more details.

I hope this helps.

The asmx-solution is almost working. The 401 auth.error really meant auth.error(!), but the EWS “auth” to set is still not determined. Almost being there it’s sad that the approach is deemed obsolete. I’ll be testing the link you supplied. Many thanks for your help.

I do have an issue that I might address here: I went through the steps: Registered an app on Azure, added the mentioned (delegated) permissions, created a new UIPath C# project, added the Office365 activity (v. 1.4.0) and finally the sequence and a “Microsoft Office 365 scope”. Entered the Application- and TennantID’s and selected InteractiveToken.

When run like that a runtime exception pops up:

Message: Compilation failures occurred: The type or namespace “Graph” does not exist in the namespace “Microsoft” (are you missing an assembly reference?)
Exception type: System.InvalidOperationException

Do I need to add something to the project?

Issue resolved. Along with the “variables”- and “Arguments”-tabs of the main editing section is an “Import”-tab. Selecting that and adding “Microsoft.Graph” helped. It seems I’m a connected (to Office265) guy now.

1 Like

Glad it worked out for you!
Happy automation!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.