| HOME NEWS TESTIMONIALS CONTACT | |
|
OWA FOR PDA OWA FOR WAP BUY ONLINE DOWNLOADS |
|
|
FINDING A USERS'S OUT-OF-OFFICE STATUS WITH EWS GETUSEROOFSETTINGSREQUEST
Here's a short article describing how you can use the Exchange Web Services (EWS) GetUserOofSettingsRequest operation to find the OOF settings for a user. This code was developed on Exchange 2007, but will no doubt also function with Exchange 2010 when it appears. The article is a simple demonstration of how you can use the GetUserOofSettingsRequest operation to get the user's OOF status. The output is then displayed using XSL. Copy the code into an .htm file, and then open it in Internet Explorer. Change the http to https if necessary, supply the name of your Exchange server, enter the smtp address of the mailbox and click the button. You will need to be logged in with an account that has permissions to read the mailbox. Hopefully, you will be rewarded with a display of the user's OOF status.
<html>
<head>
<script language="VBScript">
Dim objXMLHTTP, objXMLDoc
Sub goButton_OnClick()
strProtocol = document.all.protocol.value
strServerName = document.all.server.value
strEmail = document.all.email.value
strURL = strProtocol & "://" & strServername & "/EWS/Exchange.asmx"
Set objXMLHTTP = CreateObject("Microsoft.XMLHTTP")
objXMLHTTP.Open "POST", strURL, True
objXMLHTTP.setRequestHeader "Content-type:", "text/xml"
objXMLHTTP.onReadyStateChange = getRef("checkXMLHTTPState")
strXML = "<?xml version=""1.0"" encoding=""utf-8""?>" & _
"<soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/""" & _
" xmlns:m=""http://schemas.microsoft.com/exchange/services/2006/messages""" & _
" xmlns:t=""http://schemas.microsoft.com/exchange/services/2006/types"">" & _
"<soap:Body>" & _
"<m:GetUserOofSettingsRequest>"
If strEmail <> "" Then
strXML = strXML & "<t:Mailbox><t:Address>" & strEmail & "</t:Address></t:Mailbox>"
End If
strXML = strXML & _
"</m:GetUserOofSettingsRequest>" & _
"</soap:Body>" & _
"</soap:Envelope>"
objXMLHTTP.Send(strXML)
End Sub
Sub checkXMLHTTPState
If objXMLHTTP.readyState = 4 Then
responseStatus.innerHTML = objXMLHTTP.Status & " - " & objXMLHTTP.StatusText
Set objXMLDoc = objXMLHTTP.ResponseXML
XSLDiv.innerHTML = objXMLDoc.TransformNode(responseXSL.documentElement)
Set objXMLHTTP = Nothing
Set objXMLDoc = Nothing
End If
End Sub
</script>
<xml id="responseXSL">
<xsl:template xmlns:xsl="uri:xsl" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<b>Status:</b> <xsl:value-of select="//t:OofSettings/t:OofState"/><br/>
<b>External Audience:</b> <xsl:value-of select="//t:OofSettings/t:ExternalAudience"/><br/>
<b>Start Time:</b> <xsl:value-of select="//t:OofSettings/t:Duration/t:StartTime"/><br/>
<b>End Time:</b> <xsl:value-of select="//t:OofSettings/t:Duration/t:EndTime"/><br/>
<b>Internal Reply:</b> <xsl:value-of select="//t:OofSettings/t:InternalReply/t:Message"/><br/>
<b>External Reply:</b> <xsl:value-of select="//t:OofSettings/t:InternalReply/t:Message"/><br/>
<b>Allow External OOF:</b> <xsl:value-of select="//t:OofSettings/t:AllowExternalOof"/><br/>
</xsl:template>
</xml>
</head>
<body>
<font face="Sans-serif" size="2">
<input name="protocol" value="http" size="5">://<input name="server" value="localhost"><br>
Email:<input name="email"><br>
<input type="button" name="goButton" value="GO">
<span id="responseStatus"></span>
<p>
<div id="XSLDiv"></div>
</body>
</html>
|
| Copyright © 2003 - 2010 Lee Derbyshire. All rights reserved. | |