Showing results for 
Search instead for 
Did you mean: 
Helper III
Helper III

Moving Emails to Subfolder in round Robin style

Capture.JPGHi All,


i have a shared mailbox in which i am running the below script to move the incoming messages to subfolder in round robin style.can we achive this using microsoft flow ? or any other way to automate it in background,

thanks ,


Dim i As Long
Private WithEvents olInboxItems As Items
Private Sub Application_Startup()
  Dim objNS As NameSpace
  Set objNS = Application.Session
  Set olInboxItems = objNS.GetDefaultFolder(olFolderInbox).Items
Set objNS = Nothing
End Sub

Private Sub olInboxItems_ItemAdd(ByVal Item As Object)

    Dim objDestFolder As Outlook.MAPIFolder
    Dim moveFolder As String
    If Item.Class = olMail Then
    Select Case i
     Case 0
          moveFolder = "Folder01"
     Case 1
          moveFolder = "Folder02"
     Case 2
          moveFolder = "Folder03"
     Case 3
          moveFolder = "Folder04"
     Case 4
          moveFolder = "Folder05"
    End Select
Set objDestFolder = Session.GetDefaultFolder(olFolderInbox).Folders(moveFolder)
  Item.move objDestFolder
        End If
     i = i + 1
     Debug.Print i
     If i = 5 Then i = 0
 Set objDestFolder = Nothing
 End Sub



Community Support
Community Support

Hi @jaleefpk,


By using Round-robin style, do you mean that you want to choose all elements in a group, usually from the top to the bottom of a list and then starting again at the top of the list and so on?

There is no direct way could be used to achieve it, while if you are familiar with Custom API, please try integrating Custom APIs with flow. The following docs for your reference:

By the way, we could also consider using Switch cases if you don’t have too many folders.

A simple flow likes below for your reference.



Best regards,


Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yamao-msft ,


we have centralized mailbox in which we receive emails from cutomer ,and i have  7 agents to check emails and enter order to our ERP.

i want to distribute the incoming emails regardless of sender or subject to agents equally .


Hi @jaleefpk,


Thanks for updating.

It seems that you would like to dispatch the incoming emails to 7 agents regardless of send or subject equally.

I am afraid that it could not be achieved by using OOB flow actions directly.


Best regards,


Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I have done it using flow using the received time.but distribtion to folders are not equal.

Please let me know if you guys find any option to achieve that

I like this workaround! I also have the same usecase - creating a round-robin distribution - and would like to achieve it through flow. Please let us know if you create a way to do it. 

Community Champion
Community Champion

Have a look at

Contact me if you are interested in custom Power Automate development.

Helpful resources

Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Kudoed Authors
Users online (4,103)