Hi thanks again for the reply
im using this code to get user email address from the active directory. But it works fine in my machine and shows the email adress but when i install this in clients pc it doesnt work. Im giving the code .............
Anybody please help
Code
====
Set oRoot = GetObject("
ldap://rootDSE")
sDomain = oRoot.Get("defaultNamingContext")
Set oDomain = GetObject("LDAP://" & sDomain)
sBase = "<" & oDomain.ADsPath & ">"
LoggedIn = Environ("username")
sFilter = "(&(objectCategory=person)(objectClass=user)(name=" & LoggedIn & "))"
sAttribs = "adsPath"
sDepth = "subTree"
sQuery = sBase & ";" & sFilter & ";" & sAttribs & ";" & sDepth
Set Connection = New ADODB.Connection
Connection.Provider = "ADsDSOObject"
Connection.Open
Set RecSet = Connection.Execute(sQuery)
If Not RecSet.EOF And Not RecSet.BOF Then
Set User = GetObject(RecSet("adsPath"))
With User
On Error Resume Next
sAns = sAns & "Email Address: " & .EmailAddress & vbCrLf
MsgBox sAns
End With
End If