Getting unread message count Exchange 2003
I need to get the unread message count of all users in a particular OU (and exclude Contact objects). I found some code on the Internet, but that doesn't seem to work, it just ends after line 17 without error or any kind of output.
Set sysinfo = CreateObject("ADSystemInfo")
Set oUser = GetObject("LDAP://" & sysinfo.UserName & "")
strhomeserver = oUser.msExchHomeServerName
strhomeserver = Right(strhomeserver, Len(strhomeserver) - (InStr(strhomeserver, "cn=Servers/cn=") + 13))
strRootURI = "http://" & strhomeserver & "/exchange/" & oUser.mail & "/inbox/"
set xmlobjreq = CreateObject("MSXML2.ServerXMLHTTP")
xmlreqtxt = "<?xml version='1.0'?><a:propfind xmlns:a='DAV:'xmlns:d='urn:schemas:httpmail:'><a:prop><d:unreadcount/></a:prop></a:propfind>"
xmlobjreq.open "PROPFIND",strRootURI, false, "", ""
xmlobjreq.setRequestHeader "Content-Type", "text/xml; charset=""UTF-8"""
xmlobjreq.setRequestHeader "Depth", "0"
xmlobjreq.setRequestHeader "Translate", "f"
xmlobjreq.send xmlreqtxt
set oResponseDoc = xmlobjreq.responseXML
set oNodeList = oResponseDoc.getElementsByTagName("d:unreadcount")
For i = 0 To (oNodeList.length -1)
set oNode = oNodeList.nextNode
wscript.echo oNodeList.Text
Next
Why does it end without output and how would I wrap this in a loop to look at User objects in a particular OU? Thanks.
May 17th, 2011 9:25am
Hi
You might be better off posting in the MSDN forum for scripting help. More experts and relevant people there.
http://social.msdn.microsoft.com/Forums/en-US/scripting/threads
http://social.msdn.microsoft.com/Forums/en-US/categories
SukhSukh
Free Windows Admin Tool Kit Click here and download it now
May 17th, 2011 12:04pm
Or in the Development forum:
http://social.technet.microsoft.com/Forums/en-US/exchangesvrdevelopment/threads
Frank Wang
TechNet Subscriber Support
in forum
If you have any feedback on our support, please contact
tngfb@microsoft.com
Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
May 18th, 2011 4:59am