Thread Title: "How to identify the correct 'GAL' and its '.AddressLists.Item(number)' of a particular email account in Outlook"
I have a total of two different email accounts aligned with their 'Microsoft Exchange' (different domains) in my MS Outlook 2010 application. I have written a VBA code to identify the correct email account/ domain for my requirements. I run this code from Excel VBA window.
It can find the correct email account/ domain, but unable to figure out the exact "Global Address List" of that particular email account, and this problem lead up to mismatch of the correct number for its '.AddressLists.Item(number)', and wrong results...
I am new here, and very new to the Outlook automation, please help me.
For Example: I have one email account - "email@example.com" and another is "firstname.lastname@example.org", and both are connected with their "Global Address List" via Mircosoft Exchange Servers.
I have to only access GAL for my "email@example.com" account to identify User IDs/ Alias numbers and his/her Manager Name & Alias.
I only know programmically that ".AddressLists.Item(16)" is located to this '@yahhoo.com' account in my Outlook application, so while running my codes I have to choose the exact Item() number by clicking on many msgbox(es), but how would other employee know their exact AddressList.Item() for their '@yahhoo.com' e-mail account.
Set myAddressList = OutSess.Session.AddressLists.Item(9) ' ("Global Address List") for the first 'GAL' of '@gmmail.com'
Set myAddressList = OutSess.Session.AddressLists.Item(16) ' ("Global Address List") for the second 'GAL' of '@yahhoo.com'
Please Note ---> The order/ sequence of email accounts and their ExchangeServers and AddressList.Item() can be differ in the Outlook application of every employee who runs this VBA program.
Please help me to make this programmically smart by using the account details.
Thanks in advance!