Process Deep Dive #1 - Reading Emails & Extracting Attachments (from NHS.net)
East Suffolk and North Essex NHS Foundation Trust (ESNEFT) have an Urgent Treatment Centre (UTC), which acts as a gateway into the Emergency Department (ED).
The ED receives UTC patient referrals via an email from TPP’s SystemOne, which triggers the registration of the patient on Medway’s Patient Administration System (PAS), and a copy of the referral uploaded into the Kainos Evolve Electronic Patient Record (EPR).
This process accesses the receiving NHS.net mailbox and loads the incoming referrals into a queue awaiting data extraction. The referral emails are removed from the mail inbox, any attachments stored in a unique location with the original email archived into a folder in Outlook.
This process can be adapted to read emails from any account and to download messages and attachments into a named collection.
Pre-Requisities

Main Page

The main page steps through a sequence of subpages to run the process.
Email Count – a data item populated with the output from the [Read Email] subpage containing a count of emails to processed.
Any Emails? – if the [Email Count] is zero then the process ends to avoid the process unexpectedly terminating.

This page reads the emails from the designated NHS.net account.
Read Emails – this process stage uses the Get Received Items (Basic) action from the MS Outlook Email VBO.
The incoming emails are targeted to specific senders only using the Send Name input via the data item [Sender Name].


All new referral emails are loaded into the collection [Items] and the number of emails is stored in [Item Count]. These outputs are passed back to the Read Emails subpage.
Incoming referral emails are loaded into the [Items] collection using the data items as shown in Fig 5.

And just for good practice we add an exception for when emails cannot be accessed..

Exception E01 – an exception is thrown if outlook cannot be accessed and the process will end.
End of Part One...