I would like to create an excel tool which at some point of the operation opens the Global Address List of the Outlook. I have figured it out how to do this, but there was an issue when we tried it on a German languaged computer. I have solved it by check the UI language prior to opening the address book, but I wondered if there is a language independent way to do so? (So I don't need to create a case for every possible languages.)
My corresponding code portion is:
langCode=Application.LanguageSettings.LanguageID(msoLanguageIDUI)
Select Case langCode
Case &H409
galStr="Global Address List"
Case &H40E
galStr="Globális címlista"
Case &H407
galStr="Globale Addressliste"
Case Else
galStr="Global Address List"
End Select
Set olApp=GetObject(,"Outlook.Application")
Set olGAL=olApp.GetNamespace("MAPI"). AddressLists(galStr)
Many thanks for your help.
Use
Namespace.GetGlobalAddressList - it will return the GAL of the primary Exchange account in the profile.As for the
AddrList.AddressListTypeproperty, it will returnolExchangeGlobalAddressListonly for the GAL of the primary Exchange account. For a secondary account, it will be a genericolExchangeContainer.If you have more than one Exchange account in the profile, you can figure out if a particular address list is GAL by reading two MAPI properties using
AddressList.PropertyAccessor:PR_AB_PROVIDER_IDmust be"DCA740C8C042101AB4B908002B2FE182"andPR_DISPLAY_TYPEmust beDT_GLOBAL(0x00020000).If using Redemption (I am its author) is an option, besides exposing
RDOSession.Addressbook.GAL(similar toNamespace.GetGlobalAddressListin OOM), it also exposes RDOExchangeAccount.GALproperty on the account level (AllRoomsproperty is also exposed).