Use Desktop Outlook App activity with Shared Mailbox

This problem tortured me two full days. So I thought I might share it here.

Short message: DO NOT use the subject activity with Shared Mailbox. Instead, create a new Outlook profile with the shared mailbox as the default and only email account. Then run your robot.

Here’s the details.

I’m using the Studio 2023.10 in Standalone mode. Client is in intranet, highly regulated, no internet connection.

My requirement was to sort the emails in the Inbox of the shared mailbox to different folders/subfolders. The folder structure is like Inbox\Folder1\Folder2\ddMMyy

There is no native activity to create subfolders. No problem. I use the Microsoft.Office.Interop.Outlook Namespace, GetSharedDefaultFolder, and use the MAPIFolder object to create subfolders via Invoke Code.

Then for the email moving, I planned to use the “Move Outlook Mail Message” activity.

Problem number one, it seems the code GetSharedDefaultFolder can get the correct Inbox of the shared mailbox (I checked the EntryID). But seems the subfolder count is always 0. And when I tried to add a subfolder which already exists, it will throw an error.

Problem number two, I manually created one of the folders, such as "Inbox\Folder1\Folder2\ddMMyy, then tried to Move the mail message there, it always says “Specified folder does not exist”.

I followed a lot of suggestions from this forum. I double check the path, correct. I double check the connection to the shared mailbox, no problem. I tried forward slash, double slash, triple, quadruple, lower case for the folder path. I tried adding the shared mailbox email address, name to the folder path. All gave no effect.

The client is in healthcare business. Thousands of emails are accumulating. I had to solve this quickly.

I told the client that I tried the same workflow in the mail email account, and it works. So my client tried one thing: he created another Outlook profile with only the shared mailbox as the default account.

Then I run the robot again (changing the interop code from GetSharedDefaultFolder to GetDefaultFolder, of course).

Viola!!! Bam!!! All works as expected. The interop code in the “Invoke Code” runs ok, the Move Outlook Mail Message works ok too!

Also a weird thing. During the troubleshooting, I noticed that the Account property of the Move Outlook Mail Message is described as “The account used to access the messages to be moved.” Since I was using a service account to move message, I entered the sa’s email address there. Guess what? The emails were successfully moved, BUT, to the folder inside the Inbox of the service account, not the shared mailbox.

Which set me confused. I don’t know what the document meant by “The account used to access the messages to be moved.”

And since I put the Mail Outlook Mail Message activity inside the Use Desktop Outlook App activity. Shouldn’t it assume I’m using the same Outlook account specified?

Since I never modified any of my code, and it automatically worked after we logged in Outlook with the shared mailbox as the default account. I would assume there is a bug for the support of shared mailbox as secondary account in Outlook.

If this is the case, UiPath should clearly state it in the documentation.

Hello @wang.yu!

It seems that you have trouble getting an answer to your question in the first 24 hours.
Let us give you a few hints and helpful links.

First, make sure you browsed through our Forum FAQ Beginner’s Guide. It will teach you what should be included in your topic.

You can check out some of our resources directly, see below:

  1. Always search first. It is the best way to quickly find your answer. Check out the image icon for that.
    Clicking the options button will let you set more specific topic search filters, i.e. only the ones with a solution.

  2. Topic that contains most common solutions with example project files can be found here.

  3. Read our official documentation where you can find a lot of information and instructions about each of our products:

  4. Watch the videos on our official YouTube channel for more visual tutorials.

Hopefully this will let you easily find the solution/information you need. Once you have it, we would be happy if you could share your findings here and mark it as a solution. This will help other users find it in the future.

Thank you for helping us build our UiPath Community!

Cheers from your friendly
Forum_Staff