Robert,
Thank you for looking into this. I hope there is way to limit
permissions to only the OoO messages. An alternative (that I would like
to avoid) is creating a Windows Service in .Net that auto-starts with
the Exchange Admin account (or similar). The Exchange Administrator
would type in the username/password on the Windows Service properties
dialog so that no-one else knows the password. Another program would
then call the Windows Service to get the OoO messages.
I retrieve the OoO state for a user in two steps. The first is to get
the Exchange server name. The second is to query that Exchange server.
Below are the steps in VB.Net 2005. In your ARS workflow you would call
the .Net console app with the name of a domain controller (depending
upon your environment you may be able to use any domain controller) and
the user name. If you want to check the status of multiple users then
instead of calling this app over and over, program your app to accept a
comma separated list of user names (created in your ARS workflow) so
that you would only need to call your app just once.
Public Shared Function ActiveDirectoryGetExchangeHomeServer(ByVal
DomainController As String, ByVal UserName As String, ByRef ErrMsg As
String) As String
Try
ErrMsg = String.Empty
Dim de As New DirectoryEntry("LDAP://" & DomainController)
Dim ds As New DirectorySearcher(de,
"(&(objectCategory=person)(objectClass=user)(|(sAMAccountName=" &
UserName & ")))")
ds.PropertiesToLoad.Add("msExchHomeServerName")
Dim sr As SearchResult = Nothing
sr = ds.FindOne
Return
sr.Properties("msExchHomeServerName").Item(0).ToString
Catch ex As Exception
ErrMsg = ex.Message
End Try
Return String.Empty
End Function
Public Shared Function ExchangeGetOutOfOffice(ByVal ExchangeServer As
String, ByVal UserName As String, ByRef ErrMsg As String) As String
Try
ErrMsg = String.Empty
If ExchangeServer Is Nothing OrElse
ExchangeServer.Trim.Length = 0 Then
ErrMsg = "No Exchange server passed."
Exit Try
End If
If UserName Is Nothing OrElse UserName.Trim.Length = 0 Then
ErrMsg = "No User name passed."
Exit Try
End If
Static strQuery As String
strQuery = "<?xml version='1.0' encoding='UTF-8' ?>"
strQuery &= " <a:propfind xmlns:a='DAV:'"
strQuery &= "
xmlns:b='urn:schemas-microsoft-com:datatypes'>"
strQuery &= " <a:prop
xmlns:d='http://schemas.microsoft.com/exchange/'>"
strQuery &= " <d:oof-state/>"
strQuery &= " </a:prop>"
strQuery &= " </a:propfind>"
Dim xmlReq As New XMLHTTP
xmlReq.open("PROPFIND", "http://" & ExchangeServer &
"/exchange/" & UserName & "/NON_IPM_SUBTREE", False, "", "")
xmlReq.setRequestHeader("Content-Type", "text/xml;
charset=""UTF-8""")
xmlReq.setRequestHeader("Depth", "0")
xmlReq.setRequestHeader("Translate", "f")
xmlReq.send(strQuery)
Dim reqDoc As New Xml.XmlDocument
reqDoc.LoadXml(xmlReq.responseText)
Dim reqNodeList As Xml.XmlNodeList =
reqDoc.GetElementsByTagName("d:oof-state")
If reqNodeList.Count > 0 Then
Return reqNodeList.Item(0).InnerText
Else
ErrMsg = "ERROR: Possibly invalid server and/or user
name."
End If
Catch ex As Exception
ErrMsg = ex.Message
End Try
Return String.Empty
End Function
Stephen
-----Original Message-----
From: Action Request System discussion list(ARSList)
[mailto:[EMAIL PROTECTED] On Behalf Of Robert Molenda
Sent: Monday, June 18, 2007 4:51 PM
To: [email protected]
Subject: Re: Get Out-of-Office Message From Exchange
Hello Stephan;
Interesting that it stores the OoO message as a hidden email, I would
have thought it would be a separate attribute for the user in Exchange.
Eh' but that would be way toooooo logical.
Since it is a standard message, you will have to grant 'mail read'
access to all mailboxes, and well, that is not good nor easy to maintain
as accounts are added. Neither is adding a FULL Exchange Administrator
account permissions...
I will ask my exchange team to see if it is possible to create a
sub-administrator type permissions only.
I do know that Microsoft Communicator does show the OoO message for
people which you have added as contacts, which now makes me go hhuumm..
** HOWEVER **
If you would not mind "sharing", it would be good to pass the script on,
because I've been looking for a method of not sending notifications to
support staff if they are OoO and forget (like they always do) to set
their Remedy notifications to "None"...
Last time I tried this, it was not "open" and required mailbox access
rights :( of course we were on a different version of exchange at that
time as well.
** THANKS **
Thanks-n-advance;
HDT Platform Incident / Problem Manager & Architect Robert Molenda IT OS
PA
Tel: +1 408 503 2701
Fax: +1 408 503 2912
Mobile: +1 408 472 8097
[EMAIL PROTECTED]
Quality begins with your actions.
-----Original Message-----
From: Action Request System discussion list(ARSList)
[mailto:[EMAIL PROTECTED] On Behalf Of Heider, Stephen
Sent: Friday, June 15, 2007 7:58 AM
To: [email protected]
Subject: OT: Get Out-of-Office Message From Exchange
Exchange Server experts,
I created a .Net console app that returns 1 or 0 if a user has set their
Out of Office setting in Outlook (Exchange 2003). No special permission
needed for this.
I want to be able to display a user's Out of Office message in Remedy.
The OoO text is stored in each user's InBox as a hidden email. In order
to read email in someone else's InBox you need permission.
The network account that runs the Remedy NT service (Win 2003) and/or
SQL Server 2000 would need to be granted this permission. However, for
obvious reasons the account should not be granted Exchange Administrator
permission (which allows for reading someone else's InBox).
Here's the question:
Is it even possible to grant permission to an account so that it *only*
can read users' Out of Office messages?
Stephen
________________________________________________________________________
_______
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where
the Answers Are"
________________________________________________________________________
_______
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where
the Answers Are"
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where the
Answers Are"