Error in Office 365 Get Mail

We are facing an issue while trying to read emails using the Microsoft Office 365 Scope activity in UiPath.

What We Have Done So Far:

  • Created the App Registration in Azure.
  • Provided the required API permissions for Microsoft Graph:
  • Tried with both Delegated and Application permissions (Mail.Read, Mail.ReadWrite, etc.).
  • Added the required Tenant ID, Application (Client) ID, and Client Secret in the activity properties.
  • Granted admin consent for the permissions.
  • Verified that the mailbox is accessible and licensed.

Issue:

When we try to use the Get Mail activity, we are getting the following error:

Get Mail: Code: generalException
Message: An error occurred sending the request.

We have ensured that:

  • The email address used is valid.
  • There are no proxy/firewall issues on the machine.

Could anyone help us understand what might be causing this error and how to resolve it?

Thanks in advance!

From what I can see, your configuration looks correct and aligns with how I’ve set it up as well. However, since you haven’t shared the version of your UiPath.MicrosoftOffice365.Activities package, I recommend updating it to the latest version if you haven’t already. This might help resolve the issue.

In order to double check if the problem is the with the app itself or UiPath you can use test it using Microsoft Graph Explorer using your app token.

Hi @Ashokan_Shankar1

What version of O365 package you are using?

Also please check in the app registration, what level of permissions are provided?

For client id and secret usage, it has to be application level permissions not delegated.

Re-verify & Re-consent Permissions:

  • Crucial: For Mail.Read with Application permissions, ensure Mail.Read (Application) is selected. For Delegated permissions, ensure Mail.Read (Delegated) is selected. They are distinct.
  • Grant admin consent again for all required permissions. Wait a few minutes for propagation.
  • Try both Mail.Read and Mail.ReadWrite (Application/Delegated as appropriate) just in case a higher privilege is implicitly needed.

Test with Microsoft Graph Explorer:

  • Use Microsoft Graph Explorer (Graph Explorer | Try Microsoft Graph APIs - Microsoft Graph) to test reading emails with the same App ID and tenant ID (using an access token obtained for your app). This will quickly confirm if the Azure app registration/permissions are genuinely working independently of UiPath.
  • Endpoint: GET https://graph.microsoft.com/v1.0/users/{user-id | user-principal-name}/messages

Check UiPath Activity Package Version:

  • Ensure the UiPath Microsoft Office 365 activity package is up to date.

Troubleshoot Network:

  • Temporarily disable any local firewalls/proxies for testing to rule them out completely.