Aktuelle E-Mailadresse herauslesen
Per VB-Script die E-Mailadresse des aktuell angemeldeten Users herausfinden
Guten Tag
ich such nach einer Möglichkeit, per VB-Script die E-Mailadresse des aktuellen Users herauszufinden und in eine Variable zu speichern.
Hat jemand ein Codebeispiel oder einen Link?
Active Directory vorhanden, ich arbeite mit Exchangeserver und Outlook
ich such nach einer Möglichkeit, per VB-Script die E-Mailadresse des aktuellen Users herauszufinden und in eine Variable zu speichern.
Hat jemand ein Codebeispiel oder einen Link?
Active Directory vorhanden, ich arbeite mit Exchangeserver und Outlook
Please also mark the comments that contributed to the solution of the article
Content-Key: 58126
Url: https://administrator.de/contentid/58126
Printed on: April 19, 2024 at 00:04 o'clock
4 Comments
Latest comment
hier eine Lösung.. Einfach als Funktion mit den gewünschten Parametern aufrufen.
Function GetEmail(strAccountName, strDomainName)
Dim adoLDAPCon, _
adoLDAPRS, _
strLDAP
Set adoLDAPCon = CreateObject("ADODB.Connection")
adoLDAPCon.Provider = "ADsDSOObject"
adoLDAPCon.Open "ADSI"
strLDAP = "'LDAP://" & strDomainName & "'"
Set adoLDAPRS = adoLDAPCon.Execute("select mail from " _
& strLDAP & " WHERE objectClass = 'user'"& _
" And samAccountName = '" & strAccountName & "'")
With adoLDAPRS
If Not .EOF Then
GetEmail = .Fields("mail")
Else
GetEmail = ""
End If
End With
adoLDAPRS.Close
Set adoLDAPRS = Nothing
Set adoLDAPCon = Nothing
End Function
Quelle: google
Function GetEmail(strAccountName, strDomainName)
Dim adoLDAPCon, _
adoLDAPRS, _
strLDAP
Set adoLDAPCon = CreateObject("ADODB.Connection")
adoLDAPCon.Provider = "ADsDSOObject"
adoLDAPCon.Open "ADSI"
strLDAP = "'LDAP://" & strDomainName & "'"
Set adoLDAPRS = adoLDAPCon.Execute("select mail from " _
& strLDAP & " WHERE objectClass = 'user'"& _
" And samAccountName = '" & strAccountName & "'")
With adoLDAPRS
If Not .EOF Then
GetEmail = .Fields("mail")
Else
GetEmail = ""
End If
End With
adoLDAPRS.Close
Set adoLDAPRS = Nothing
Set adoLDAPCon = Nothing
End Function
Quelle: google