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.AddressListType
property, it will return olExchangeGlobalAddressList
only for the GAL of the primary Exchange account. For a secondary account, it will be a generic olExchangeContainer
.
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_ID
must be "DCA740C8C042101AB4B908002B2FE182"
and PR_DISPLAY_TYPE
must be DT_GLOBAL
(0x00020000
).
If using Redemption (I am its author) is an option, besides exposing RDOSession
.Addressbook.GAL
(similar to Namespace.GetGlobalAddressList
in OOM), it also exposes RDOExchangeAccount.GAL
property on the account level (AllRooms
property is also exposed).