MS Outlook 2010 .SenderEmailAddress returns a huge string of characters

こ雲淡風輕ζ 提交于 2019-12-29 09:17:24

问题


I've searched and searched for an answer so I'll post this here. I'm trying to create a macro that will move 2 week old messages from my inbox to a specific folder I created for each of my coworkers. The macro successfully loops though all inbox message older than two weeks. However, when I use the .SenderEmailAddress it retuns a huge string of characters instead of ###@####.com. How do I just get the senders email address?

Without giving the exact string (security issue), here is what I get with "X"'s in place of some characters:

/o=XXXXXXX/ou=Exchange Administrative Group (XXXXXXXXXXXXXXX)/cn=Recipients/cn=XXXXX@XXXXX

At the end of the string is the Subject line text.

Any help would be greatly appreciated! :-)


回答1:


This is a perfectly valid EX type address (as opposed to SMTP).

Try to use MailItem.Sender.GetExchangeUser().PrimarySmtpAddress.

You will need to check for nulls/errors of course in case the sender is not an Exchange user or if the address cannot be retrieved.




回答2:


This MSDN documentation will help.



来源:https://stackoverflow.com/questions/16945487/ms-outlook-2010-senderemailaddress-returns-a-huge-string-of-characters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!