BOT Fails to Move Emails to Success Folder After High Volume Processing

Hi all,

I’m facing an issue where the BOT fails to move emails to the “Success” folder in a shared mailbox after processing a large volume of messages. It works as expected for approximately 70 emails, but after that, it throws a system exception during the “Move Outlook Mail Message” activity with the following error:

“The specified folder doesn’t exist.”

The process itself is quite straightforward:

  • The BOT retrieves emails from Outlook
  • Downloads any attachments and saves them locally
  • If attachments are present, the emails are moved to the BOT’s “Success” folder

This issue seems to occur only after handling a large batch of emails.

Could anyone please help identify the cause or suggest a solution or workaround?

@rahul.rajendran,

Are you using O365 activities or Outlook activities?

Outlook activities can result in this issue due to memory consumption. Try using O365 activities for moving the mail.

@ashokkarale Do I need integration service connection for that?

@rahul.rajendran

It can work with either integration services or with setting up office 365 scope via azure app creds

Cheers

@rahul.rajendran,

It can work with Azure App or integration service connection as well!

Is this a one time activity ??

If yes - easiest option would be to split the process in to different batches.

Example- batch of 50. If attachment found - moved to success folder. else move to processed folder

repeat the same for other batches as well. Point is - Since you are stopping the process after each batch - run time memory will be reset so that it wont create issue for each batch

@rahul.rajendran

try using retry scope to move email activity with 5 seconds delay.

Are you saying to process the first 50 emails, wait 10 seconds, and then move on to the next 50?

Nope. Wait wont work. You should stop the process or it should complete after a batch of 50. Start again

Since you are moving the emails everytime - it wont process the same email. Only point is to keep a counter and complete the process if the counter value is greater than 50 or whichever you configure

You need to run the process multiple times to complete the backlog

If this is a one time process- this should work

Hi @rahul.rajendran

the error happens because outlook loses connection to the folder after processing many emails.
So try add a retry or delay before moving emails, restart the outlook session after every 40/50 emails, and process emails in smaller batches.

If helpful, mark as solution. Happy automation with UiPath!

So It’s more efficient to schedule the bot to run at regular intervals, processing 50 emails in each batch?

Kindly clarify whether this activity is one time or not.

memory issue will be there if you are giving load for a longer time. If the system is getting crashed frequently - This would be a method to avoid the failure. efficiency - If you could find a solution which could run in one shot - That would be the best option

In my older project - I have splitted and ran multiple times which helped me to achieve

Sorry, I didn’t understand what you meant by whether the activity is a one-time task or not.
This process retrieves all email messages, downloads their attachments, and saves them locally. If successful, the attachments are then moved to a ‘Success’ folder in Outlook.

I mean

from a business perspective - are you planning to schedule this process on a continuous basis or you need to run only one time to clear the backlogs

Hi this is what I had done

  • The BOT was modified to process only 50 unread emails per execution cycle.
  • At the end of each job execution, the same process is re-triggered if additional unread emails remain.
1 Like

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