web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Moving Emails to Subfo...
Power Automate
Unanswered

Moving Emails to Subfolder in round Robin style

(0) ShareShare
ReportReport
Posted on by 64

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
       
        Err.Clear
         
     i = i + 1
     Debug.Print i
     If i = 5 Then i = 0
 Set objDestFolder = Nothing
 End Sub

 

 

  • v-yamao-msft Profile Picture
    Microsoft Employee on at

    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:

    https://docs.microsoft.com/en-us/flow/developer/register-custom-api

    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.

    1.PNG

     

    Best regards,

    Mabel

  • jaleefpk Profile Picture
    64 on at

    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 .

     

  • v-yamao-msft Profile Picture
    Microsoft Employee on at

    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,

    Mabel

  • jaleefpk Profile Picture
    64 on at
    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
  • entropyeater Profile Picture
    9 on at

    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. 

  • VictorIvanidze Profile Picture
    13,083 on at

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 414

#2
11manish Profile Picture

11manish 331 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard