jcpetu Posted March 23, 2011 Share Posted March 23, 2011 Hello all, I am trying to migrate some Outlook mail users from one address list to another. By now I managed to identify each address list and the corresponding entries, but I do not know how to get the mail address. I google to find out the object fields of mail address but even thought it does not bring mail address. Below is what I have. Any help will be appreciated. $oOApp=ObjCreate("Outlook.Application") If @error Or Not IsObj($oOApp) Then Exit $NameSpace = $oOApp.getnamespace("MAPI").addresslists ;Address book $AlistCount=$NameSpace.count ;Number of address lists For $i=1 to $AlistCount $NameSpace=$oOApp.getnamespace("MAPI").addresslists($i) $oAdrsEntry = $NameSpace.addressentries ConsoleWrite("Address list "&$i&"="&$NameSpace.name&"("&$oAdrsEntry.count&" items)"&@CRLF) ;get address list name & number of items Next $NameSpace=$oOApp.getnamespace("MAPI").addresslists(3) ; get access to the address list I need $oAdrsEntry = $NameSpace.addressentries ConsoleWrite("Name=" &$oAdrsEntry.item(3000).name & @CRLF & _ ; get info of particular entry "Address=" &$oAdrsEntry.item(3000).address & @CRLF & _ "Id=" &$oAdrsEntry.item(3000).id & @CRLF) Link to comment Share on other sites More sharing options...
water Posted March 23, 2011 Share Posted March 23, 2011 Hi jcpetu, I'm not at my PC right now - I try to answer your question on saturday. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
jcpetu Posted March 23, 2011 Author Share Posted March 23, 2011 Hi jcpetu,I'm not at my PC right now - I try to answer your question on saturday.Thanks a lot Water, I will see the response on Monday because I wont be at my office by saturday. I really appreciate it.Have a good weekend. Link to comment Share on other sites More sharing options...
water Posted March 26, 2011 Share Posted March 26, 2011 (edited) According to the Outlook Object Model Reference property "address" represents the email address.$oAdrsEntry.item(3000).addressIf this doesn't return the information you need then you could use methods GetContact, GetExchangeDistributionList or GetExchangeUser depending on the value of the AddressEntryUserType property. You then have access to the corresponding Outlook item.Example can be found here.BTW: In my signature you can find a link to the OutlookEX UDF (User Defined Functions) which has a lot of useful Outlook stuff. Edited March 26, 2011 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
jcpetu Posted March 28, 2011 Author Share Posted March 28, 2011 Thanks a lot water. I was testing the script under Win XP and other Outlook version and it works properly. It seems not to be working under Vista and Outlook 2007. I appreciate your help. Regards. Link to comment Share on other sites More sharing options...
water Posted March 28, 2011 Share Posted March 28, 2011 (edited) I have run into problems too with Outlook versions after Outlook 2002 (I was testing the OutlookEX UDF on Windows XP and Outlook 2002). The next version of the UDF solves this problems plus adds functions to work with Address Lists. If you like to test I can send you the pre-release code by PM. Edited March 28, 2011 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
jcpetu Posted March 28, 2011 Author Share Posted March 28, 2011 Hi water, if you can send me the beta by pm I will test it and let you know. Thanks a lot and regards. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now