18-01-22 12:04 AM
Answered! Go to Answer.
18-01-22 11:40 AM
PR_TRANSPORT_MESSAGE_HEADERS
property. However, it can only be accessed via the URI schema: "http://schemas.microsoft.com/mapi/proptag/0x007D001F"Dim app = CreateObject("Outlook.Application")
Dim _nameSpace = app.GetNameSpace("MAPI")
Dim folder = _nameSpace.GetDefaultFolder(Outlook_Folder_ID)
If Sub_Folder <> "" Then
For each name as string in Sub_Folder.Split("\")
folder = folder.Folders(name)
Next
End If
'See https://msdn.microsoft.com/en-us/library/office/aa210946(v=office.11).aspx
'for mail item properties
Dim dataTable As New Data.DataTable
dataTable.Columns.Add("EntryID", Type.GetType("System.String"))
dataTable.Columns.Add("To", Type.GetType("System.String"))
dataTable.Columns.Add("CC", Type.GetType("System.String"))
dataTable.Columns.Add("Subject", Type.GetType("System.String"))
dataTable.Columns.Add("Body", Type.GetType("System.String"))
dataTable.Columns.Add("Attachments", Type.GetType("System.String"))
dataTable.Columns.Add("ReceivedOn", Type.GetType("System.DateTime"))
dataTable.Columns.Add("SentOn", Type.GetType("System.DateTime"))
dataTable.Columns.Add("SenderName", Type.GetType("System.String"))
dataTable.Columns.Add("SenderEmailAddress", Type.GetType("System.String"))
dataTable.Columns.Add("Unread", Type.GetType("System.Boolean"))
Dim folderItems = If(Filter_Expression <> "", folder.Items.Restrict(Filter_Expression), folder.Items)
For Each item As Object In folderItems
If Not TypeOf item Is MailItem Then Continue For
Dim row As Data.DataRow = dataTable.NewRow
row("EntryID") = item.EntryID
row("To") = item.To
row("CC") = item.CC
row("Subject") = item.Subject
row("Body") = item.Body
Dim attachments As String = ""
For Each attachment As Object In item.Attachments
If attachment.Type = 1 Then
attachments = attachments & "|" & attachment.DisplayName
End If
Next
row("Attachments") = If (attachments.Length = 0, "", attachments.SubString(1))
row("SentOn") = item.SentOn
row("ReceivedOn") = item.ReceivedTime
row("SenderName") = item.SenderName
row("SenderEmailAddress") = If (item.SenderEmailType = "EX",item.Sender.GetExchangeUser.PrimarySmtpAddress,item.SenderEmailAddress)
row("Unread") = item.Unread
dataTable.Rows.Add(row)
Item_Count += 1
Next
Items = dataTable
18-01-22 11:40 AM
PR_TRANSPORT_MESSAGE_HEADERS
property. However, it can only be accessed via the URI schema: "http://schemas.microsoft.com/mapi/proptag/0x007D001F"Dim app = CreateObject("Outlook.Application")
Dim _nameSpace = app.GetNameSpace("MAPI")
Dim folder = _nameSpace.GetDefaultFolder(Outlook_Folder_ID)
If Sub_Folder <> "" Then
For each name as string in Sub_Folder.Split("\")
folder = folder.Folders(name)
Next
End If
'See https://msdn.microsoft.com/en-us/library/office/aa210946(v=office.11).aspx
'for mail item properties
Dim dataTable As New Data.DataTable
dataTable.Columns.Add("EntryID", Type.GetType("System.String"))
dataTable.Columns.Add("To", Type.GetType("System.String"))
dataTable.Columns.Add("CC", Type.GetType("System.String"))
dataTable.Columns.Add("Subject", Type.GetType("System.String"))
dataTable.Columns.Add("Body", Type.GetType("System.String"))
dataTable.Columns.Add("Attachments", Type.GetType("System.String"))
dataTable.Columns.Add("ReceivedOn", Type.GetType("System.DateTime"))
dataTable.Columns.Add("SentOn", Type.GetType("System.DateTime"))
dataTable.Columns.Add("SenderName", Type.GetType("System.String"))
dataTable.Columns.Add("SenderEmailAddress", Type.GetType("System.String"))
dataTable.Columns.Add("Unread", Type.GetType("System.Boolean"))
Dim folderItems = If(Filter_Expression <> "", folder.Items.Restrict(Filter_Expression), folder.Items)
For Each item As Object In folderItems
If Not TypeOf item Is MailItem Then Continue For
Dim row As Data.DataRow = dataTable.NewRow
row("EntryID") = item.EntryID
row("To") = item.To
row("CC") = item.CC
row("Subject") = item.Subject
row("Body") = item.Body
Dim attachments As String = ""
For Each attachment As Object In item.Attachments
If attachment.Type = 1 Then
attachments = attachments & "|" & attachment.DisplayName
End If
Next
row("Attachments") = If (attachments.Length = 0, "", attachments.SubString(1))
row("SentOn") = item.SentOn
row("ReceivedOn") = item.ReceivedTime
row("SenderName") = item.SenderName
row("SenderEmailAddress") = If (item.SenderEmailType = "EX",item.Sender.GetExchangeUser.PrimarySmtpAddress,item.SenderEmailAddress)
row("Unread") = item.Unread
dataTable.Rows.Add(row)
Item_Count += 1
Next
Items = dataTable
18-01-22 05:49 PM
Hi Devneet,
I attempted to make those changes but I'm getting the below error at the time of running the code stage itself:
"Internal : Could not execute code stage because exception thrown by code stage: Value does not fall within the expected range." Any ideas?
Lourdes Urena | Sr. Solutions Engineering (RPA) | W.W. Grainger, Inc.
Ph: 224-724-5080| lourdes.urena@grainger.com |www.grainger.com
18-01-22 06:33 PM
18-01-22 07:50 PM
13-04-23 03:25 AM
Hi BluePrism community, Devneet,
I'm working on the above enhancement to our Outlook VBO code and it certainly works for the individual circumstance of internet header structure.
I need to expand the usability for hundreds of users within an organisation that may have received emails with varying types of internet header structure. Often these variances stem from being an internal email, an external email, and external automated engine emails.
Each of these received emails will have "Message-ID: <InfoToCapture@example> unique following structure".
Can someone please provide a suitable code snippet to reliably target "Message-ID: <wildcard/all_within_<_>> and ignore anything after the ">" sign?
13-04-23 09:37 AM
Hi @xlxu001
I noticed this post and that you originally were getting an error stating "value does not fall within expected range". I have been receiving this error intermittently on a couple of my bots for a few months, we havent made any code changes so its proving a bit difficult to identify the cause of it, can you tell me if you know what was causing the error in your code and what the fix was? Im thinking its maybe an issue with the outlook profile or possibly just a slow microsoft exchange connection issue.
13-04-23 04:15 PM
Hi Michael,
I remembered it was something that had to so with the schemas URL changing, which if you google the above URL it actually doesn't work, but I'm not sure what the Google search I did was after that in order to get the right schemas URL to implement.