For each row in DT, move mails to respective folders in the mailbox

Hi Team,

I am using an office 365 application scope to read the mails from outlook folder “inbox” (Mail A, Mail B, Mail C, Mail D, Mail E).

  • Variable Type - {OfficeMailMessage
  • Variable Name - Mail_List}**

Finally the mails shall be moved from Inbox folder to “Folder A” and “Folder B” in the same mailbox. (Please note that there are three Folders in the mailbox - “Inbox”, “Folder A” and "Folder B)

I am using the for each loop for Mail_list to process and update the datatable column “Move” as shown in the figure below (Datatable Variable Name - dtResult):

Now I want to scan the datatable dtResult to check the Values in column “Move” to move the mail to respective mail Folders (ie: Folder A - if Yes and Folder B if No)

Problem statement: I need efficiet way to move the mails to proper folders without using double looping mechanism.

Kindly let me know if more clarity is needed on this.

Thanks and Regards,

@THIRU_NANI , @supermanPunch

Hi! @hacky ,

can we try with this


1 Like


How about using Dictionary and Switch as the following? (3.5 KB)


1 Like

Hi @hacky,

While updating the dataColumn as “Yes”. Right after this activity use the below activity

to move the mail to Folder A.

Similarly, after updating “No”. Move the mail to Folder B.

No need to iterate the datatable again.