- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
15-02-22 04:50 PM
In our team, we started using MS Outlook VBO instead of MAPIEx as MAPIEx has lot of issues.
In MS Outlook VBO, i am using Read Received Emails action and its reading perfectly fine however from TO Address this action is reading the display name only however we need display name plus EMAIL ADDRESS which is missing.
Can anyone please let me know how we can get the email address from TO Address using read received email action ? I tried updating the code but still its reading just names
------------------------------
Mohammad Naveed
SR. RPA Developer
------------------------------
Answered! Go to Answer.
Helpful Answers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
17-02-22 03:33 PM
i written the below code and replaced row("To") = item.To line of code in Outlook VBO (Get Internal Items) action page code stage with below code and its working perfectly fine.
dim recips as object, recip as object, PA as object, Eid as string
Eid = ""
Const PR_SMTP_ADDRESS as string = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"
recips = item.Recipients
for each recip in recips
PA = recip.PropertyAccessor
Eid = Eid & ";<" & PA.GetProperty(PR_SMTP_ADDRESS) & ">"
next
If Left(Eid,1) = ";" then
Eid = Right(Eid, Len(Eid)-1)
end if
row("To") = Eid
------------------------------
Mohammad Naveed
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
15-02-22 05:55 PM
https://docs.microsoft.com/en-us/office/vba/api/outlook.recipient.address
------------------------------
John Carter
Professional Services
Blue Prism
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
16-02-22 03:37 PM
can you please suggest as to get the email address , any alternate solution ?
------------------------------
Mohammad Naveed
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
16-02-22 11:54 PM
Assuming the email is addressed to someone within your company (i.e. someone registered in Exchange) then the default behavior of Outlook is present them based on Display Name as opposed to SMTP Email Address. If you need the email address, and it's an internal user, you can add a new function to the Global code page and use the code below to perform a conversion from Display Name to SMTP Email Address.
Private Function GetSenderSMTPAddress(ByVal mail As Outlook.MailItem) As String
Dim PR_SMTP_ADDRESS As String = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"
If mail Is Nothing Then
Throw New ArgumentNullException()
End If
If mail.SenderEmailType = "EX" Then
Dim sender As Outlook.AddressEntry = mail.Sender
If sender IsNot Nothing Then
If sender.AddressEntryUserType = Outlook.OlAddressEntryUserType.olExchangeUserAddressEntry OrElse sender.AddressEntryUserType = Outlook.OlAddressEntryUserType.olExchangeRemoteUserAddressEntry Then
Dim exchUser As Outlook.ExchangeUser = sender.GetExchangeUser()
If exchUser IsNot Nothing Then
Return exchUser.PrimarySmtpAddress
Else
Return Nothing
End If
Else
Return TryCast(sender.PropertyAccessor.GetProperty(PR_SMTP_ADDRESS), String)
End If
Else
Return Nothing
End If
Else
Return mail.SenderEmailAddress
End If
End Function
You'll need to add a line or two to the code stage in the Internal_Get_Items action to make a call the above function. Just pass in the mail item and you should get back the SMTP email address. Below is a screenshot of where I might add the line to call the above function.
Cheers,
------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
16-02-22 11:59 PM
Take a look at the following thread. There's some custom code shown that can be used to convert the recipients Display Name to their email address assuming their a registered user on the Exchange server.
https://community.blueprism.com/communities/community-home/digestviewer/viewthread?GroupId=145&MessageKey=298a9f5c-c94d-4092-acd0-737fd3f5f5e0&CommunityKey=3743dbaa-6766-4a4d-b7ed-9a98b6b1dd01&tab=dig...
Cheers,
------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
17-02-22 11:28 AM
I written the code to get the email address from Recipients property Address however not tried with this approach which is written by Amy.
Its working perfectly fine , however when we have same multiple times with just little addition in the name then this code is not fetching the email address,
example, in outlook in TO field if you enter the name Mohammad, Naveed and press Ctrl + K to resolve the names then you will get pop up to select the correct name and when we have this scenario then Amy's code is returning blank.
Any other way to get the email address with exactly same display name ?
------------------------------
Mohammad Naveed
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
17-02-22 11:43 AM
Hi @MohammadNaveed,
In your scenario the name found in the TO address doesn't match the actual Exchange "Display Name" for the user? I suppose the question is whether that name value shows up under any other property in the Exchange entry of that user? If it does than you should be able to query that property. If it doesn't, I imagine you'd need to add some code to normalize the name to the appropriate format before calling the conversion function. In other words, if the failing names are always Surname, Given Name you could queue off the comma, swap the names, and call the function again.
Does that make sense?
Cheers,
------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
17-02-22 03:33 PM
i written the below code and replaced row("To") = item.To line of code in Outlook VBO (Get Internal Items) action page code stage with below code and its working perfectly fine.
dim recips as object, recip as object, PA as object, Eid as string
Eid = ""
Const PR_SMTP_ADDRESS as string = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"
recips = item.Recipients
for each recip in recips
PA = recip.PropertyAccessor
Eid = Eid & ";<" & PA.GetProperty(PR_SMTP_ADDRESS) & ">"
next
If Left(Eid,1) = ";" then
Eid = Right(Eid, Len(Eid)-1)
end if
row("To") = Eid
------------------------------
Mohammad Naveed
------------------------------
