Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enumerating contacts in a public folder via VB and ADSI

Status
Not open for further replies.

SerMajestic

Programmer
Apr 11, 2001
1
0
0
DE
Hello there,

does anybody have a hint for my problem:

Scenario:
W2K Server / Exchange 2K Server

Task:
Listing all contacts in a public address book (public folder)

Tools used:
VB6, CDOEXM, ADSI

I tried this code, which is originally from MSDN, in a sub.
This should finally open a recordset, which should give me the opportunity to 'traversal search' the recordset and list the contents of the container-object:

....

Dim Conn As New ADODB.Connection
Dim RS As New ADODB.Recordset
Dim Info As New ADSystemInfo
Dim sDomainName As String
Dim sSQL As String

sDomainName = Info.DomainDNSName

sFolderURL = &quot;file://./BackOfficeStorage/&quot; & sDomainName & &quot;/Public Folders/<Name of Public Folder>&quot;

Conn.Provider = &quot;EXOLEDB.DataSource&quot;
Conn.ConnectionString = sFolderURL
Conn.Open

sSQL = &quot;Select * &quot;
sSQL = sSQL & &quot; from scope ('deep traversal of &quot; & Chr(34)
sSQL = sSQL & sFolderURL & Chr(34) & &quot;')&quot;

RS.Open sSQL, Conn

If Not RS.EOF Then
RS.MoveFirst
End If

While Not RS.EOF
Debug.Print RS.Fields(&quot;DAV:displayname&quot;).Value
RS.MoveNext
Wend
RS.Close

....

Actual Problem:
When executing this code, the following error shows up:
Error '3706'. Provider cannot be found. Possibly not installed. (This is not the original text, since I am working on a german system and quick-translated this message).


Any clues ?

Thanks in advance,
Ron
 

following is a VB solution to obtaining the whole of the &quot;Contacts&quot; folder.

Set myNameSpace = Application.GetNamespace(&quot;MAPI&quot;)
Set myFolder = myNameSpace.GetDefaultFolder(olFolderContacts)

In order to access first item of the &quot;Contacts&quot; folder that is first contact following statement is used :
.........
count = myFolder.Items.Count
Set myItem = myFolder.Items(i)
Do While i > 0
Set myItem = myFolder.Items(i) 'Move to next record.
'operate upon the contacts properties here...
i = i - 1
Loop

This is how items in &quot;Contacts&quot; folder can be accessed.
About listing them in Address book must also be simple.
u can go to msdn's site for help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top