cancel
Showing results for 
Search instead for 
Did you mean: 

Outlook VBO doesn't read emails, when sender is a Distribution List

pranavred
Level 6
Has anyone encountered this error while using latest Outlook VBO? When the sender is a Distribution List (Outlook distribution list which contains several users. Some users have permissions set up to "send as" DL), Get mail doesn't work with Outlook VBO.  
Pranav
6 REPLIES 6

david.l.morris
Level 15
Are you using the Sender Name or Sender Email inputs to 'Get Received Items' in order to filter the messages that are received? If so, have you tried removing those inputs first? And have you confirmed what happens if you try to pull all items within the time frame? Does it still not get the email sent from a DL?

Dave Morris, 3Ci at Southern Company

pranavred
Level 6
No, I'm not using any Sender Name or Sender Email inputs.   I tried adding Received Earliest and Received Latest. It doesn't work even with them added. I'm able to pull other emails if the ""Unread"" condition doesn't apply to the email coming from Distribution List.  I requested to create a Distribution List in my firm and tested. It doesn't work only for emails coming from a distribution list.   
Pranav

pranavred
Level 6
I think there's something wrong with this line of code in Internal_Get Items page in Outlook VBO.  If (item.SenderEmailType = ""EX"",item.Sender.GetExchangeUser.PrimarySmtpAddress,item.SenderEmailAddress)   If the sender is internal to the organization, SenderEmailAddress does not return the email address, but gives the following/O=EXCHANGELABS/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=EB1A373A70B94DA59BABB713C2EBA4E6-APP_SUPP_RP I think that line above was meant to fix this issue, but it's not. Instead, it throws off the entire Get email.  https://docs.microsoft.com/en-us/office/client-developer/outlook/pia/ho…  
Pranav

Hello Venkata Pranav Reddy Thathireddygari,
Did you found any solution for this?I'm having the same problem.

------------------------------
Cleidson Cordeiro
------------------------------

You'll need to check the sender to see if it's a distribution list or not. I believe this should help:
public string GetSenderAddress(MailItem mail)
{
	// Checks if the sender is an Exchange address.
	if (mail.SenderEmailType == "EX") {
		// Checks if the sender is a distrubtion list, which requires a different function call to
		// get the email address instead of the exchange address.
		if (mail.Sender.AddressEntryUserType == OlAddressEntryUserType.olExchangeDistributionListAddressEntry) {
			return mail.Sender.GetExchangeDistributionList().PrimarySmtpAddress;
		} else {
			return mail.Sender.GetExchangeUser().PrimarySmtpAddress;
		}
	// If the sender is not an exchange address (which typically means it's an external email), 
	// SenderEmailAddress will contain the correct email address.
	} else {
		return mail.SenderEmailAddress;
	}
}


You'll have to adapt it to the Outlook VBO, but this should get the email address instead of the Exchange string for distribution lists. It's very similar code to resolve the To/CC/BCC fields to the correct email address if you have problems with those too.

------------------------------
Nicholas Zejdlik
RPA Developer
------------------------------

Thank you very much I made the adjustment:
Row ("SenderEmailAddress") = If (item.SenderEmailType = "EX",if(item.Sender.AddressEntryUserType = OlAddressEntryUserType.olExchangeDistributionListAddressEntry,item.Sender.GetExchangeDistributionList.PrimarySmtpAddress,item.Sender.GetExchangeUser.PrimarySmtpAddress),item.SenderEmailAddress)

I'll do more tests but for how much it's working!

------------------------------
Cleidson Cordeiro
------------------------------