Process Deep Dive #2- Reading Emails & Extracting Attachments (from NHS.net)
This page reads the emails loaded into the [Items] collection and saves all the attachments into a unique folder.
[UTC Referral Path] is an Environment Variable that references the root folder to store the attachment referrals.
The Create Item Folder ID calculation stage creates a unique folder name in which to store the referral and uses the logic Right([Items.EntryID], 8) to take the last 8 digits of the EntryID. This is stored on ItemID.
The email is checked to see if it has any attachments using [Items.Attachments]<>"" If not then it is ignored. This decision is necessary to prevent empty folders being created.
The Create Directory object creates a unique folder to store the referral attachment. The Directory Path is created using the input [UTC Referral Path] & [ItemID]. The output from the object includes a Success flag that is used to determine if the process was successful.
The Folder Created decision checks to see if the folder creation was successful using the logic [Success]=True. If the folder was not created then the exception E02 is raised and the whole process fails as there is more likely a larger issue to be resolved.
Using the Save Attachments action, any attachments contained within the email are stored in the unique folder that was created in the previous step.
Write To Queue
The Write to Queue page takes the collection of incoming referrals and writes them to the UTC – Incoming Referrals queue ready for data extraction. The Status for each item is set to Pending.
The Archive Email page takes the original email and moves it to an inbox subfolder in Outlook. An Environment Variable called UTC Email Subfolder defines the folder.
The Move Email to Inbox Sub Folder is the action within the MS Outlook Email VBO.
End of Part Two...