cancel
Showing results for 
Search instead for 
Did you mean: 

Blue Prism Outlook meeting request to collection

TaraMcGonigle
Level 3
Hello, I am trying to get all meeting requests that come into my outlook to go into a collection- I can use "Get Received Items" but that picks  up normal mail and no meeting requests. I think it might be something to do with the code stage but not too sure what to change (the original for "Get Items" code is below). Any help appreciated, Thanks.

------------------------------
Tara McGonigle
------------------------------
8 REPLIES 8

Anonymous
Not applicable
unfortunately the format saved by BP site is very small, so man can't read the image and see the actual code.
Try to post the code as text in the reply snippet.

------------------------------
Cohen
RPA Developer

Romania
------------------------------

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

------------------------------
Tara McGonigle
------------------------------

Anonymous
Not applicable
i need to know inputs and outputs pls

------------------------------
Cohen
RPA Developer

Romania
------------------------------

Inputs
Name:                                     Data Type:                      Value:
Filter Expression                     Text                                 [Filter Expression]
Outlook Folder ID                    Number                          [Outlook Folder ID]
Sub Folder                              Text                                 [Sub Folder]


Outputs
Name:                                     Data Type:                      Store In:
Items                                       Collection                       Items
Item Count                              Number                          Items Count

------------------------------
Tara McGonigle
------------------------------

Anonymous
Not applicable
it gives me some errors. nevertheless, i would try to work with Outlook as a normal Web page, with button clicks, and insert, sending keys. 

if you go to Outlook ==> File ==>Open and Export ==> Import and Export ==>Export to File ==> Next ==>CSV==>Next==>ScrollUp and Select Calendar ==>Next==>Insert PATH==>Next==>Finish==>Insert Range (1.1.2019) (2.2.2020)==>OK.

Now you have a CSV whom you can import in Collection and to stuff you need.

------------------------------
Cohen
RPA Developer

Romania
------------------------------

Is it possible to do this via Outlook application or is the only way forward through the use of the Web app? as im needing to do this through application to get the desired result, thanks

------------------------------
Tara McGonigle
------------------------------

The above is set up to assume that each Item is also a MailItem. (Hence the line "If Not TypeOf item Is MailItem Then Continue For"). You need to check if the type is MeetingItem, and then you can go from there.

For documentation on MeetingItem and other Outlook options, check here: https://docs.microsoft.com/en-us/office/vba/api/outlook.mailitem

------------------------------
Ami Barrett
Sr Product Consultant
Blue Prism
Richardson, TX
------------------------------

MattPalmer
Level 5
I built my own Outlook Action to specifically 'Get ReportItems' (ReportItems are emails that come back as undeliverable). 

My line of code which controls which item I get is

If TypeOf (SubFolderObject.Items(i)) Is Microsoft.Office.Interop.Outlook.ReportItem Then


The 'TypeOf' of a meeting item is 'MeetingItem'.  So your code could be:


If TypeOf (SubFolderObject.Items(i)) Is Microsoft.Office.Interop.Outlook.MeetingItem Then

rest of code to put details into collection


------------------------------
Matt Palmer
Business Process Specialist
Chesapeake Energy
America/Chicago
------------------------------