This template can be used as a starting point for automating processes where the input data comes from an email account. The code here works with a normal email account, but it can work also with a shared email account if correctly configured.
The user should create in the email account a folder where the successfully processed emails are moved and configure the ProcessedEmailsMailFolder parameter in the Config.xlsx file.
This ReFramework can be used when processing a list of emails. The datatype of the TransactionItem is MailMessage and the datatype of the TransactionData is List<MailMessage>. By default, this uses Exhange Server for retrieving the emails, but you can use also other providers and adapt the framework to it.
The main issue that is adjusted is the fact that the list of emails is not marked as read in the Init step, but in the EndProcess step.
The other main adjustment by this is that if the robot crashes in the middle of the process then, if the robot is ran again it will still find the unread emails that were not processed yet.
Init: Inside the 'GetInitialData.xaml' workflow the 'GetEmails.xaml' workflow is invoked. All the unread emails are added to a list, but they are not marked as read.
* Inside the GetEmails.xaml, 'GetAppCredentials.xaml' is invoked. This is used for the Exchange server authentication. If you are working with Integrated Outlook, you don't need that.
Process: Beside the code that any developer can add, the last step is to invoke 'MoveProcessedEmail.xaml' which moves the just processed transaction item into the folder for the processed emails (the one that was previously created and configured in the ProcessedEmailsMailFolder parameter in the Config.xlsx file) only if the transaction was successful.
End Process: Before the invoke of 'CloseAllApplications.xaml', the workflow 'MarkAsReadAllEmails.xaml' is invoked and all the emails existing in the folder created prior by the user for the processed emails to be moved and then they are marked as read.
This adjusted ReFramework can work both for a normal email account and also for shared email accounts, but for the shared email, the developer must add the required information in the Exchange activities used for reading the email, moving the mail and mark as read the messages.