UPDATE - THIS WORKS NOW - SEE BELOW
Lets talk this through then.
This is how we use the REF:
I have the Init phase, in which I will extract all the relevant information from each mail, and add this data to the Queue. So this is where I have my For Each, enumerating all the e-mails.
Then I got the Process phase that processes each transaction from the Queue.
At the end of my Process, I ultimately need to move the mail in question to another outlook/exchange folder. In case the processing of the mail goes awry, I would move the mail to another folder.
I need to get the unique “handle” on my specific mail. Metadata such as Sender, Subject is not usable here, I need a unique ID identifying precisely the mail in question.
This is how I thought of course I would like to just add the mail to the Queue, as I would then suspect I have complete assurance of what mail I am processing.
Seeing how this is not possible (it is in BluePrism by the way), I found a workaround:
In the Init phase, add this to the Queue Item: item.Headers(“Message-ID”)
In the Proces phase, extract the MessageID from the TransactionItem, and use the GetOutlookMailMessages activity to get a list of (1) mail, where the Property “FilterByMessageIDs” is populated with an array of (1) MessageID.
Then at the end of Process, use a ForEach to enumerate the list of (1) MailMessage, and within the ForEach use MoveOutlookMessage activity to move mail in question to whatever folder.
This actually works, but is of course dependant on you knowing which folders the mails are in. The ultimate solution would be able to find a mail within an exchange account whereever it is, but I can move on now.
Thanks for the help SenzoD, and please give feedback/questions if you like…