Solved

Retrieving Data From Ms. Exchange Server Through Visual Basic

Posted on 2002-07-02
3
202 Views
Last Modified: 2013-11-25
I want Visual basic to connect to Ms. Exchange server For email addresses and the windows 2000 server user manager so that it can authenticate the user from the user database. How do i connect to windows 2000 ,exchange server database through VB
0
Comment
Question by:asaeed
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
GregD earned 200 total points
ID: 7124455
Your best bet is to connect via ADSI & ADO. you can connect to Exchange 5.5/2000 & W2K using ADSI.

Try the ADSI Resource kit for your first point of call

http://www.microsoft.com/ntserver/nts/downloads/other/ADSI25/default.asp

Then check out msdn, there's loads of scripts about connecting to exchange, like this one for retreiving email addresses

-----------------------------------------------------------
Dim objMailbox As IADs
Dim varAddrs As Variant

Set objMailbox = _
        GetObject("LDAP://Server/cn=Mailbox,cn=Recipients,ou=Site,o=Org")

' Retrieve and print the smtp address
Debug.Print objMailbox.Get("mail")
Debug.Print objMailbox.Get("rfc822Mailbox")

'Retrieve and print the X.400 address
Debug.Print objMailbox.Get("textencodedORaddress")

'Load the other proxy addresses into the property cache
objMailbox.GetInfoEx Array("otherMailbox"), 0
varAddrs = objMailbox.GetEx("otherMailbox")

'Now varAddrs is an array of strings
For i = LBound(varAddrs) To UBound(varAddrs)
    Debug.Print varAddrs(i)
Next I

Set objMailbox = Nothing
-----------------------------------------------------------

This script will connect to a domain 2k or nt4 and retreive the user names.

----------------------------------------------------------
Dim usr As IADsUser

Set dom = GetObject("WinNT://DOMAIN-NAME")
dom.Filter = Array("User")

For Each usr In dom
    Debug.Print usr.Name
   
Next

Cheers
Greg.
0
 
LVL 2

Author Comment

by:asaeed
ID: 7125241
Will this also get the Passwords cuz i what to match the user name and Password for further process
0
 
LVL 1

Expert Comment

by:GregD
ID: 7125369
No, you can't retreive a password but you can authenticate as someone else for example

Dim openDS As IADsOpenDSObject
Dim comp As IADs
 
Set openDS = GetObject("LDAP:")
Set comp = openDS.OpenDSObject("LDAP://CN=DCNAME,OU=Domain Controllers,DC=DOMAIN,DC=co,DC=uk", "administrator", "password", ADS_SECURE_AUTHENTICATION)


This will authenticate to the AD by binding to the domain controller object DCNAME as the administrator. It will send the authentication using either NTLM or Kerberos depending on your setup, you only need to worry about getting the username & password from the user securely.

if the username/password is incorrect a runtime error is returned, you can capture this in your error handler using err.description & err.number.

Cheers
Greg.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
using Access 8 75
Exit a vb6 apps when a calling it apps closes 15 52
Protecting vb6 & .Net code Obfuscation 18 152
Export PDF Form fields to Access  or Excel  in Tab order 16 80
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question