Hallo Leute,
ich habe ein Problem und sitze schon lange daran und hoffe nun das eine von euch mir helfen kann. :confused:
Ich möchte ein VB-Programm machen, dass mir aus mehreren bestimmten Verteilern die E-mail-Adressen auslist. Das funktionier soweit, jedoch haben einige Leute bis zu 5 Adressen drinne stehen und ich möchte alle andern mit auslesen, aber da scheitert es. Ich finde keine einfach und möglichst verständliche Lösung, aber vllt. könnt ihr mir ja helfen.
Outlook 2010
Visual Basic 2010
'BENÖTIGTE VERWEISE
Imports Microsoft.Office.Interop.Outlook
Imports Microsoft.Office.Interop
'//
'// BENÖTIGTE DEKLERATIONEN
'//
Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olAL As Outlook.AddressList
Dim olEntry As Outlook.AddressEntry
Dim oldlMember As Outlook.AddressEntry
'//
'// OUTLOOK LADEN UND GAL AUSWÄHLEN
'//
olApp = New Outlook.Application
olNS = olApp.GetNamespace("MAPI")
olAL = olNS.AddressLists("Globale Adressliste")
'//
'// VARIABLEN
'//
Dim ListName As String
Dim CSV As String
Dim Config As String = System.AppDomain.CurrentDomain.BaseDirectory & "config.txt"
Dim Name As String
Dim Mail As String
Dim lMemberCount As Long
'//
'// NAME DER VERTEILERGRUPPE AUS TXT DATEI
'//
FileOpen(2, Config, OpenMode.Input)
While EOF(2) = False
ListName = LineInput(2)
'//
'// OUTLOOK VERTEILERLISTE IM GAL SUCHEN
'//
olEntry = olAL.AddressEntries(ListName)
'//
'// ANZAHL DER USER IN DER GRUPPE AUSLESEN
'//
lMemberCount = olEntry.Members.Count
'//
'// CSV DATEI ERSTELLEN
'//
My.Computer.FileSystem.WriteAllText(System.AppDomain.CurrentDomain.BaseDirectory & ListName & ".csv", "Name,Email" & vbCrLf, False)
CSV = System.AppDomain.CurrentDomain.BaseDirectory & ListName & ".csv"
'//
'// USER AUS DER GRUPPE AUSLESEN
'//
FileOpen(1, CSV, OpenMode.Append)
For i = 1 To lMemberCount
oldlMember = olEntry.Members.Item(i)
Name = oldlMember.Name
Mail = oldlMember.GetExchangeUser.PrimarySmtpAddress
MsgBox(Mail)
Print(1, Name & "," & Mail & vbCrLf)
Next i
FileClose(1)
End While
FileClose(2)
Vielen Dank im vorraus!