GetMail O365 cannot read from Shared Mailbox

Hello Community!

This is my first cry for help on the forum so go easy on me.

I am currently attempting to read from a shared mailbox using the UiPath.MicrosoftOffice365.Activities.Mail.GetMail activity, which is of course nested inside an UiPath.MicrosoftOffice365.Activities.Office365ApplicationScope.

I am using Username Password authentication mode. I believe my scope properties are correct because if I try to read the Inbox from my own mailbox it works fine. Without making any changes except for adding the shared mailbox email address (in the form sharedmailbox@abc.xyz) to the “Account” property of GetMail (previously it was empty) I receive exception:

“Microsoft.Graph.ServiceException: Code: ErrorFolderNotFound” with message “The specified folder could not be found in the store.”

Keep in mind the “Mail Folder” still has the default value of “Inbox”. I do have access to this mailbox under my account and in Desktop Outlook I can read mail, send mail…all the normal permissions.

Any insight on this would be appreciated. I did not include the workflow file since I would need to remove most the fields for it be sensitized anyway.

Welcome James!

This isn’t a solution, but wanted to add on that I’m experiencing a similar issue with using the Use Outlook 365 activity, where it seems to only find folders for the user’s account, and not in a shared inbox, even though I’ve both added the shared inbox in the activity, and confirmed the account has access to it.

Would be great if anyone has a solution to this.

1 Like

Hi @jeremiah.s.kmc
please find the below link for your reference , hope this might help you

Hi @James_Donlevy and @jeremiah.s.kmc

I’ve just tested it with both UiPath.MicrosoftOffice365.Activities v1.11.1 and v1.12.1-preview and I successfully retrieved emails from the Inbox folder of my shared mailbox.

It the issue persists try the following:

  1. In scope activity, make sure that Mail & Shared services are selected.
  2. Delete the locally stored “office365.tokens…” token file from %appdata%\UiPath\authentication
  3. Run the workflow again.

P.S. One more sanity check: can you please use “Send Email” activity to send an email to your shared mailbox address, i.e. set To = same value you are using in Get Mail’s account field?

My organization does not allow for imap, O365 is the preferred way. Thanks though.

Thanks for you comments. I followed the steps and am still facing the same issue.

I am able to send mail to the mailbox, I can even send mail ‘on behalf of’ this mailbox if I put the shared mailbox address in the ‘From’ field of send mail activity.

I am starting to think there is a setting that needs to be changed on the mailbox itself

@James_Donlevy does your custom Azure AD registered application have Mail.Read.Shared and Mail.ReadWrite.Shared delegated permissions set?

Hi @ovidiuponoran, I am also getting an error when trying to fetch emails after using the Office365 scope activity. This is for a shared mailbox that i have access to and i am receiving the message below - The ‘Inbox’ Folder is the default one

GETMail_Error

My permissions are set below in Azure:
Mail.ReadWrite.Shared
Mail.Read
Mail.Read.Shared
Mail.Send.Shared
User.Read

Any other permissions that should be granted for this to work? They are all Delegated permissions.

It seems like the folder ‘Inbox’ can’t be found, please confirm that the wanted inbox folder actually is named ‘Inbox’. Depending on your language and cultural settings it may be different.

Regards
JM

Yes Joe, the wanted folder is called “Inbox”. I have also tried other folders within the shared mailbox and receive the same error.
image

Hi @ivan.garcia

  1. What type of Authentication are you using in Office 365 scope activity?
  2. From Outlook Desktop / Outlook on the Web are you able to access the shared mailbox folders when you are connected with your user email account (which I assume is used when connecting with InteractiveToken) ?

Thank you for your reply. I am using Application ID and Secret - below are the permissions in Azure AD.
2. And yes, the shared mailbox appears under my user email account inbox since i am a member/owner.

Question regarding permissions: Did you have to provide admin permissions in Azure by any chance? Would you be able to provide a screenshot of your permissions that are working on your end?

When you are using applicationID and Secret you need to set application Graph API permissions for your registered Azure app instead of delegated permissions.

Foe example see https://docs.uipath.com/activities/docs/microsoft-office-365-scope#application-id-and-secret

Hi Ovidiu, my organization does not allow for application API permissions on mailboxes, only delegated. Is there an Authentication type that i can use for Unattended bots and delegated permissions? The documentation you linked to likely needs to be updated to make sure there is no future confusion as it does not seem clear.

Also the graph API documentation mentions mail can be retrieved with delegated permission. Get message - Microsoft Graph v1.0 | Microsoft Docs

@ivan.garcia, for unattended bots the only alternative using delegated permissions is IntegratedWindowsAuthentication. Please read the constraints and prerequisites that apply to this type of authentication here: Integrated Windows Authentication · AzureAD/microsoft-authentication-library-for-dotnet Wiki · GitHub.

I am having same issue where I am unable to Read Emails from Shared Mailbox. I have tried a million things already. In terms of permissions on Azure App I have attached the screenshot. It seems for Shared Mailbox , Delegated permission is the only option. We cannot set application permission for Mail.Read.Shared. As per UiPath doc: “Application ID and Secret” does not work with Delegated permission. So I tried with Integrated Windows Auth, but get an error. Interactive Token is not an option for me as mine is an Unattended use case. UserName/Password does not follow modern authentication so that’s not an option as well. Has anyone been able to Read Email from a Shared Mailbox successfully ? Its extremely frustrating to see something this simple is not working as expected.

In your O365 Scope activity what was the Authentication Type you used?
Can you please provide screenshot of which values did you provide?