OK, WebDAV does not have the ability itself to get a list of mailboxes. However you can use other APIs and even use an OWA call to get a list of mailboxes.
Reading the GAL:
WebDAV itself cannot do this. You could use the OWA GALFIND command, which has some limited ability. You could also use ADSI, CDO 1.21 or Extended MAPI as long as you’re running in-network. There is no Exchange Web Service (EWS) call for doing this (at least not in Exchange 2007 SP1)).
GALFIND is an OWA call which is supported to use. It is not a WebDAV call. Basically, you do a GET against a URL and pass it search parameters.
Format of the OWA call:
sServerURL = "http://"+ sServerURL + "/public/?Cmd=galfind
Information on the unsupported call is covered in the following article:
Customizing Microsoft Outlook Web Access
Basic call - use the following URI and choose "GET - OWA Call" - you will not need a body, all info past to OWA are in the uri:
Here are the possible search Parameters:
DN Display Name ex: Robert Jones
FN First Name ex: Robert
LN Last Name ex: Jones
TL Title ex: Big Manager
AN Alias ex: bobj
CP Company ex: microsoft
DP Department ex: Exchange
OF Office ex: Bld 15/2124
CY City ex: Redmond
Note: There is no ability to search against other fields such as phone number, etc.
Example Raw Request:
GET - OWA Call http://myexchangeserver/exchange/myuser/?cmd=galfind HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)
Here are the supported methods:
How To Work with Distribution Lists Using CDO (1.x) from Visual Basic
241474 HOWTO: Render the Global Address List with ADSI
166106 HOWTO: Getting the Contents of the Exchange Global Address List
More on using Extended MAPI to read the Mailbox Table:
The Mailbox Table in Exchange holds a list of Mailboxes and related mailbox information. Reading this table can only be done with Extended MAPI or WMI can be used on an Exchange 2003 server.
Extended MAPI can be used with Exchange 5.5 and later.
XCLN: How to Retrieve Last Logon Time of Exchange Users Using Extended MAPI
How to loop through mailboxes on Exchange by using the GetMailboxTable method
With Exchange 2003 and later, you can use WMI:
Here is a sample of using GALFIND:
' GALFIND Sample
' GALFIND will return results which can be consumed by your application as xml.
' You can test the URL by putting it into IE and seeing the results.
' TODO: Have Basic Authentication turned ON on the virtual directory for the item and no anonymous.
' Note: there is no Translate header set for a GET against an OWA URL – That’s because we are not using WebDAV, we are using the results from an OWA page.
sub ReadFileText (sFile)
Dim objFSO 'As FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set oTS = objFSO.OpenTextFile(sFile)
sText = oTS.ReadAll
set oTS = nothing
Set objFSO = nothing
ReadFileText = sText
Private Sub WriteFileText(sFilePath, sText)
Dim objTextFile 'As Object
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Set objTextFile = objFSO.CreateTextFile(sFilePath, True)
' Write a line.
shref="http://myexchangeserver.company.com/exchange/?cmd=galfind&DN=bobbie" mce_href="http://myexchangeserver.company.com/exchange/?cmd=galfind&DN=bobbie" ' TODO: change
sUserName = "Administrator" ' TODO: change
sPassword = "" ' TODO: change
set HttpWebRequest = CreateObject("microsoft.xmlhttp")
if sPassword = "" then
HttpWebRequest.Open "GET", sHREF , False
HttpWebRequest.Open "GET", sHREF , False, sUserName, sPassword
sResponse = HttpWebRequest.ResponseText ' Returns as text
Set HttpWebRequest = Nothing