Exchange Server 5.5: Extract NT Domain Username

Exchange Server 5.5: Extract NT Domain Username

Post by GF » Sat, 19 Jul 2003 02:40:28



Hello everyone,

does anybody know whether it's possible to extract the NT Domain username
from an exchange server through MAPI libraries?
Please assume I'd be using VB6 to do all this.
So far I'v managed to extract:

- SMPT Address (972947486)
- Surname (974192670)
- Name (973471775)
- Telephone (973602846)
- Office (974716959)
- Department (974651423)

Thanx in advance

GF

Here's a snip of the code:

Dim objAddressList As MAPI.AddressList
Dim objAddressEntries As MAPI.AddressEntries
Dim objAddressEntry As MAPI.AddressEntry

Dim intCounterEntries, intCountGood, intCounter, intCounterFields
Dim aData
Dim intPropSize
Dim boolGood

Dim intSTMPAddress
Dim intDepartment
Dim intName
Dim intSurname
Dim intTelephone
Dim intOffice
intSTMPAddress = 972947486
intDepartment = 974651423
intName = 973471775
intSurname = 974192670
intTelephone = 973602846
intOffice = 974716959

.
.
.
.

For intCounterEntries = 0 To objAddressEntries.Count - 1
    Set objAddressEntry = objAddressEntries.Item(intCounterEntries + 1)
    ' first the distribution list
    If Err.Number = 0 Then
      If objAddressEntry.DisplayType = 0 Or objAddressEntry.DisplayType = 1
Or objAddressEntry.DisplayType = 6 Then
        intPropSize = objAddressEntry.Fields.Count
        aData(intCounter, 0) = objAddressEntry.Name
        aData(intCounter, 1) =
objAddressEntry.Fields.Item(intSTMPAddress).Value
        aData(intCounter, 2) = objAddressEntry.Fields.Item(intSurname).Value
        aData(intCounter, 3) = objAddressEntry.Fields.Item(intName).Value
        aData(intCounter, 4) =
objAddressEntry.Fields.Item(intTelephone).Value
        aData(intCounter, 5) = objAddressEntry.Fields.Item(intOffice).Value
        aData(intCounter, 6) =
objAddressEntry.Fields.Item(intDepartment).Value
        aData(intCounter, 7) = objAddressEntry.DisplayType
        intCounter = intCounter + 1
        Err.Clear
    End If
 Else
    aData(intCounter, 0) = ""
    Err.Clear
 End If
Next

 
 
 

Exchange Server 5.5: Extract NT Domain Username

Post by Ronny On » Sat, 19 Jul 2003 16:11:38


The NT account is not exposed as a property of an AddressEntry. It is an
attribute of the mailbox in the directory.

You need to query ADSI for the Assoc-NT-Account attribute of the mailbox.
Despite AD in the name, ADSI does not require Active Directory; the Exchange
Directory in 5.5 supports ADSI. VB can access ADSI either directly through
ADSI functions or indirectly through ADO by using the ADSI OLE DB Provider
(Connection.Provider = "ADsDSOOBJECT").

One example in VB is at:
http://groups.google.com/groups?hl=en&lr=lang_en&ie=UTF-8&oe=UTF-8&sa...

There are plenty of other examples if you search for "Assoc-NT-Account" in
MSDN and/or Google.


Quote:> does anybody know whether it's possible to extract the NT Domain username
> from an exchange server through MAPI libraries?


 
 
 

Exchange Server 5.5: Extract NT Domain Username

Post by GF » Sun, 20 Jul 2003 19:30:52


Thanx for the tips..
I'll get into it right away!!

GF


Quote:> The NT account is not exposed as a property of an AddressEntry. It is an
> attribute of the mailbox in the directory.

> You need to query ADSI for the Assoc-NT-Account attribute of the mailbox.
> Despite AD in the name, ADSI does not require Active Directory; the
Exchange
> Directory in 5.5 supports ADSI. VB can access ADSI either directly through
> ADSI functions or indirectly through ADO by using the ADSI OLE DB Provider
> (Connection.Provider = "ADsDSOOBJECT").

> One example in VB is at:

http://groups.google.com/groups?hl=en&lr=lang_en&ie=UTF-8&oe=UTF-8&sa...

> There are plenty of other examples if you search for "Assoc-NT-Account" in
> MSDN and/or Google.



> > does anybody know whether it's possible to extract the NT Domain
username
> > from an exchange server through MAPI libraries?