‎09-05-22 07:21 AM
Hi,
I need to get flag/Category information on emails in Outlook by entryID. The process will first add the information when getting the cases from an Outlook folder but then it will defer cases and I need to check the status (for flag and category) on the email again before handling. Does anyone have an suggesting on how I can do that?
Blue Prism version 6.10.3
‎09-05-22 08:12 AM
Dim app = CreateObject("Outlook.Application")Dim _nameSpace = app.GetNameSpace("MAPI")Dim internetHeaders As StringDim folder = _nameSpace.GetDefaultFolder(Outlook_Folder_ID)If Sub_Folder <> "" ThenFor each name as string in Sub_Folder.Split("\")folder = folder.Folders(name)NextEnd If'See https://msdn.microsoft.com/en-us/library/office/aa210946(v=office.11).aspx'for mail item propertiesDim dataTable As New Data.DataTabledataTable.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"))dataTable.Columns.Add("Categories", Type.GetType("System.String"))dataTable.Columns.Add("FlagRequest", Type.GetType("System.String"))Dim folderItems = If(Filter_Expression <> "", folder.Items.Restrict(Filter_Expression), folder.Items)For Each item As Object In folderItemsIf Not TypeOf item Is MailItem Then Continue ForDim row As Data.DataRow = dataTable.NewRowrow("EntryID") = item.EntryIDrow("To") = item.Torow("CC") = item.CCrow("Subject") = item.Subjectrow("Body") = item.BodyDim attachments As String = ""For Each attachment As Object In item.AttachmentsIf attachment.Type = 1 Thenattachments = attachments & "|" & attachment.DisplayNameEnd IfNextrow("Attachments") = If (attachments.Length = 0, "", attachments.SubString(1))row("SentOn") = item.SentOnrow("ReceivedOn") = item.ReceivedTimerow("SenderName") = item.SenderNamerow("SenderEmailAddress") = If (item.SenderEmailType = "EX",item.Sender.GetExchangeUser.PrimarySmtpAddress,item.SenderEmailAddress)row("Unread") = item.Unreadrow("Categories") = item.Categories.ToStringrow("FlagRequest") = item.FlagRequest.ToStringdataTable.Rows.Add(row)Item_Count += 1NextItems = dataTable‎09-05-22 08:39 AM
Thanks for the reply 😊
The problem I have is after I added the items in the queue with information about flag/category there might be a change for the flag/category made in Outlook by a human so before I handle each case I need to do an extra check on the mail item to see if the flag/category has change. My though was to use the EntryID to get the information about flag/category status. But I can’t get any modification to the code to work regarding that. I only get the information when I retrieve cases base on folder or recipient. I guess I could retrieve all items by a particular folder and then filter on entryID but thought I would ask and see if anyone had an other solution.
‎09-05-22 01:02 PM