Accessing Public Folders with ADO
Accessing Public Folders with ADO
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
VBScript
Note The following example uses a file URL with the Exchange OLE DB (ExOLEDB) provider. The ExOLEDB provider also supports The HTTP: URL Scheme. Using The HTTP: URL Scheme allows both client and server applications to use a single URL scheme.
<!-- Accessing Public Folders with ADO Set the required permissions on Exchange Server and Internet Information Services (IIS). Instructions 1) Create a folder named "test" in the Exchange store. 2) Save the file in that folder. 3) Change the strLocalPath and DomainName variables to reflect your mailbox and domain. 4) Save the file. 5) Open Internet Service Manager and browse to the "test" folder. 6) Right-click and go to Properties. 7) Go to the Directory Security tab. 8) Click the Edit button next to the handshake icon. 9) Clear the Anonymous Access check box. 10) Select the Digest Authentication and Integrated Windows Authentication check boxes. 11) Click OK. 12) Click OK. 13) Load the Active Server Pages (ASP) page into the browser. --> <HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft FrontPage 4.0"> <TITLE></TITLE> </HEAD> <BODY> <% Dim Rec Dim Rs Dim strURL Dim strQ Dim DomainName Dim strLocalPath ' Specify your own domain. DomainName = "somedomain.example.com" ' Specify a URL to a folder or item. strLocalPath = "public folders/publicfoldername" Set Rec = CreateObject("ADODB.Record") Set Rs = CreateObject("ADODB.Recordset") ' This URL is for a public folder. strURL = "file://./backofficestorage/" & DomainName & "/" & strLocalPath Rec.Open strURL ' Construct the SQL query to run on the folder. ' To avoid confusion in escaping quotes, ' Chr(34)s are used to delimit the URL. strQ = "select " strQ = strQ & " ""urn:schemas:mailheader:content-class"" " strQ = strQ & ", ""DAV:href"" " strQ = strQ & ", ""DAV:displayname"" " strQ = strQ & " from scope ('shallow traversal of " strQ = strQ & Chr(34) & strURL & Chr(34) & "')" strQ = strQ & " ORDER BY ""DAV:displayname"" " Rs.Open strQ, Rec.ActiveConnection Rs.MoveFirst While Not Rs.EOF Response.Write Rs.Fields("DAV:displayname").Value & "</br>" Rs.MoveNext Wend Rs.Close Rec.Close %> <p> </BODY> </HTML>
Send us your feedback about the Microsoft Exchange Server 2003 SDK.
Build: June 2007 (2007.618.1)
© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.