I found the following information on this site, but I am unable to get it to work. All it brings back is the xml page with no data. I am running a Windows 2003 Server with Exchange 2003 Server.
When the code gets to This line..
If objDoc.loadXml(objRequest.ResponseText) Then
The results return False and I don't receive any data. Does anyone know what the problem may be?
Re: ASP: Exchange 2003 Free/Busy Lookup
--------------------------------------------------------------------------------
I have figured this out myself. The problem was with Anonymous access being
disabled within the IIS for the public folder. Once I enabled this I was
able to retrieve an XML file of the specified users free/busy status.
Also the code I was using was for exchange2000 and not 2003, this brought
back a HTML formatted page of the specified users free/busy status. Once I
used the 2003 code this brought back an XML file.
I hope this helps someone else out.
"Andy" wrote:
Quote:
Originally Posted by
Hi,
>
I'm trying to get a users free/busy status from exchange from within a
website and
using the code below, but when I run this a login page from MS Outlook Web
Access is retrieved from the server rather than a XML file containing the
users free/busy status for the specified time period.
>
I've spent all day looking for solutions to this but I'm stumped. I have
been looking for an Exchange newsgroup but there doesn't seam to be one, does
anyone know if i can post this some where else to get a response from an
Exchange expert.
>
The Server is 2003, with Exchange 2003.
>
Any help would be very much appreciated!
>
Code being run is shown below and was modified from the following location:
http://msdn.microsoft.com/library/d...status_http.asp
>
<%
' Initialize variables.
' The public folder server that contains the user's free/busy information.
strServer = "????????????"
>
' The user's e-mail address.
strUser = "andy.long@????????????.co.uk"
>
' Build the URL with the freebusy command. Specify a start date/time of
' 08:00 (UTC) 27 Sep 2004, an end date/time of 20:00 (UTC) 27 Sep 2004, an
' interval of 60 minutes, and the e-mail address of the user. Multiple
' e-mail addresses can be specified by appending one or more
' "&u=SMTP:user@example.com" command parameter values to the URL string.
strUrl="https://" & strServer & "/public/?cmd=freebusy" & _
"&start=2006-10-24T08:00:00Z" & _
"&end=2006-10-24T20:00:00Z" & _
"&interval=60" & _
"&u=SMTP:" & strUser ' & "&u=SMTP:user2@example.com"
>
' Initialize the XMLHTTP object.
set objRequest=createobject("Msxml2.ServerXMLHTTP")
>
' Open the request object with the GET method and
' specify that it will be sent asynchronously.
objRequest.open "GET", strUrl, false
>
' Set the Content-Type header.
objRequest.setRequestHeader "Content-Type", "text/xml"
>
' Set the Content-Length header.
objRequest.setRequestHeader "Content-Length", 0
>
' Set the Accept-language header.
objRequest.setRequestHeader "Accept-Language", "en-us"
>
' Send the GET method request.
objRequest.send
>
' The request was successful.
If 200 = objRequest.status Then
' Uncomment this line to see the XML response.
response.write(objRequest.responsetext)
>
' Create the DOM document.
Set objDoc = createobject("msxml2.domdocument")
>
' Load the XML response body.
If objDoc.loadXml(objRequest.ResponseText) Then
>
' Build a list of the WM:item XML nodes, corresponding to the
' returned user and free/busy information of the freebusy
' command. The WM: namespace is typically assigned the a: prefix
' in the XML response body. The namespaces and their associated
' prefixes are located in the attributes of the WM:response node
' of the XML response.
Set objNodeList=objDoc.selectNodes("//a:item")
>
' Iterate through the WM:item nodes.
For Each objItemNode In objNodeList
>
' Use an XPath query to get the WM:displayname node
' from the WM:item node.
set objDisplayNode = objItemNode.selectSingleNode("a:displayname")
>
' Use an XPath query to get the WM:fbdata node
' from the WM:item node.
set objFBNode = objItemNode.selectSingleNode("a:fbdata")
>
' Display free/busy information.
response.write("Display name: " & objDisplayNode.Text)
response.write("Free/busy data: " & objFBNode.Text)
response.write("<br>")
Next
End If
>
Else
response.write(objRequest.status & " " & objRequest.statustext)
End if
>
' Clean up.
Set objRequest = nothing
Set objDoc = nothing
%>