Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1812to1816
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Globale AdressListe in Excel auslesen

Globale AdressListe in Excel auslesen
25.02.2021 15:54:54
Jens
Hallo zusammen,
Ich suche schon länger möchte gern den öffentlichen Exchange-Ordner „olExchangePublicFolderAddressEntry = 2“ auslesen (unter Case 2)
das wird ausgegeben
/O=QWER/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=C22*********************
und erwarte eigentlich "spencer05@spencer.de"
Bei „olExchangeRemoteUserAddressEntry“ springe ich ja in den GetExchangeUser und bei „olExchangePublicFolderAddressEntry“ ?
Kann mir jemand helfen?
Hier der aktuelle Code:
  • 
    Sub GAL()
    Dim oOutlook As Object
    Dim appOL As Object
    Dim oGAL As Object
    Dim oContact As Object
    Dim oUser As Object
    Dim addrEintraege As Object
    Dim i As Long
    On Error Resume Next
    Set oOutlook = GetObject(, "Outlook.Application")
    If Err.Number = 0 Then 'Tests if Outlook is started
    MsgBox ("Bitte schließen Sie Outlook!")
    Else
    Set appOL = CreateObject("Outlook.Application")
    Set oGAL = appOL.GetNameSpace("MAPI").AddressLists("Globale Adressliste"). _
    AddressEntries
    Application.DisplayAlerts = False
    For i = 1 To oGAL.Count
    Set oContact = oGAL.Item(i)
    Select Case oContact.AddressEntryUserType
    Case 0  'olExchangeRemoteUserAddressEntry
    Set oUser = oContact.GetExchangeUser
    Debug.Print oUser.LastName
    Debug.Print oUser.FirstName
    Debug.Print oUser.PrimarySmtpAddress
    Debug.Print oUser.BusinessTelephoneNumber
    'usw
    Set oUser = Nothing
    Case 1  'olExchangeDistributionListAddressEntry
    Set oUser = oContact.GetExchangeDistributionList()
    Set addrEintraege = oUser.GetExchangeDistributionListMembers()
    Debug.Print oUser.Name
    If Not (addrEintraege Is Nothing) Then
    For Each exchMitglied In addrEintraege
    Debug.Print (exchMitglied.Name)
    Next
    End If
    Case 2  'olExchangePublicFolderAddressEntry
    Set oUser = oContact.GetGlobalAddressList '="Nothing"
    Debug.Print oContact.Name       'der Name ist ok
    Debug.Print oContact.Address    'die Address ist eine Exchange Adresse
    Case 3  'olExchangeAgentAddressEntry
    Case 4  'olExchangeOrganizationAddressEntry
    Case 5  'olExchangeRemoteUserAddressEntry
    Set oUser = oContact.GetExchangeUser
    Debug.Print oUser.LastName
    Debug.Print oUser.FirstName
    Debug.Print oUser.PrimarySmtpAddress
    Debug.Print oUser.BusinessTelephoneNumber
    'usw
    Case 10 'olOutlookContactAddressEntry
    Case 11 'olOutlookDistributionListAddressEntry
    Case 20 'olLdapAddressEntry
    Case 30 'olSmtpAddressEntry
    Case 40 'olOtherAddressEntry
    Case Else
    Stop
    End Select
    Next i
    Set appOL = Nothing
    Set oGAL = Nothing
    Set oContact = Nothing
    Set oUser = Nothing
    Set addrEintraege = Nothing
    Err.Clear
    End If
    End Sub
    


  • Jens

    1
    Beitrag zum Forumthread
    Beitrag zu diesem Forumthread

    Betreff
    Datum
    Anwender
    Anzeige
    AW: Globale AdressListe in Excel auslesen
    26.02.2021 08:33:14
    Yal
    Hallo Jens,
    probiere mal mit Early binding, also Extras > Verweise
    auf Microsoft Outlook 13.0 Object Library
    Dann hast Du das Objektmodell von Outlook im Objektkatalog (F2) und über Intellisense.
    Auch ein Break-point (F9) an der richtige Stelle um ein Blick im Lokal-Fenster zu werfen.
    Somit kommst schneller deinem Problem auf den Spur.
    Und auch schneller von "Basiskenntnisse in VBA" auf die nächste Stufe.
    VG
    Yal
    Anzeige

    Beliebteste Forumthreads (12 Monate)

    Anzeige

    Beliebteste Forumthreads (12 Monate)

    Anzeige
    Anzeige
    Anzeige