Sign in to follow this  
Followers 0
jcpetu

Outlook address book mail address

7 posts in this topic

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)

Share this post


Link to post
Share on other sites



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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

According to the Outlook Object Model Reference property "address" represents the email address.

$oAdrsEntry.item(3000).address

If 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 by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hi water, if you can send me the beta by pm I will test it and let you know.

Thanks a lot and regards.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0