cancel
Showing results for 
Search instead for 
Did you mean: 

Read msg file in Outlook VBO

Neel1
MVP
hello guys,

when i am trying to read .msg file type using outlook VBO  then in the attachment column is coming blank in item collection and of course not saving this type as attachment as well in a folder.

i believe exchange objects are different from normal files but what can be solution for this.
is the latest OUTLOOK VBO  (6.10.5) able to handle this?

------------------------------
Neeraj Kumar
Technical Architect
------------------------------
1 BEST ANSWER

Best Answers

david.l.morris
Level 14
I don't know if the base VBO provided by Blue Prism has been fixed for that yet. It might be in 6.10.5, but I cannot confirm. In any case, you could just use this code below for now which worked for me last I checked. Here's the code from a Save Attachments code stage (VB.NET) that I edited a few years ago. It's slightly modified. I think the only thing I changed was to add '5' in which is the .msg attachment type.

Dim app = CreateObject("Outlook.Application")
Dim _nameSpace As Microsoft.Office.Interop.Outlook.NameSpace = app.GetNameSpace("MAPI")

Dim item = _nameSpace.GetItemFromID(Entry_ID)
If item Is Nothing Then Return

If Not Folder_Path.EndsWith("\") Then Folder_Path &="\"

For Each attachment As Object In item.Attachments
	If (attachment.Type = 1 OrElse attachment.Type = 5 OrElse attachment.Type = 6) AndAlso attachment.FileName Like File_Pattern Then
		attachment.SaveAsFile(Folder_Path & attachment.FileName)
	End If
Next​


------------------------------
Dave Morris
3Ci at Southern Company
Atlanta, GA
------------------------------
Dave Morris 3Ci at Southern Company Atlanta, GA

View answer in original post

2 REPLIES 2

david.l.morris
Level 14
I don't know if the base VBO provided by Blue Prism has been fixed for that yet. It might be in 6.10.5, but I cannot confirm. In any case, you could just use this code below for now which worked for me last I checked. Here's the code from a Save Attachments code stage (VB.NET) that I edited a few years ago. It's slightly modified. I think the only thing I changed was to add '5' in which is the .msg attachment type.

Dim app = CreateObject("Outlook.Application")
Dim _nameSpace As Microsoft.Office.Interop.Outlook.NameSpace = app.GetNameSpace("MAPI")

Dim item = _nameSpace.GetItemFromID(Entry_ID)
If item Is Nothing Then Return

If Not Folder_Path.EndsWith("\") Then Folder_Path &="\"

For Each attachment As Object In item.Attachments
	If (attachment.Type = 1 OrElse attachment.Type = 5 OrElse attachment.Type = 6) AndAlso attachment.FileName Like File_Pattern Then
		attachment.SaveAsFile(Folder_Path & attachment.FileName)
	End If
Next​


------------------------------
Dave Morris
3Ci at Southern Company
Atlanta, GA
------------------------------
Dave Morris 3Ci at Southern Company Atlanta, GA

bruce.liu
Staff
Staff
Hi Neeraj,

The latest version of Outlook VBO on the DX definitely has the feature. In fact it should have been there for quite some time already.

------------------------------
Bruce Liu
Senior Product Consultant, Professional Services
Blue Prism
Australia/Sydney
------------------------------