Re: count items in public folder, from code on webserver
- From: "Nut Cracker" <nutcracker@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 14 Dec 2006 10:47:10 -0600
thank you very much ... I will investigate the WMI approach and post back.
- NuTs
"Glen Scales [MVP]" <gscales@xxxxxxxxxxxxxxxxxxx> wrote in message
news:uC91MawHHHA.5104@xxxxxxxxxxxxxxxxxxxxxxx
If your running Exchange 2003 then you can use the Exchange_PublicFolder
WMI class and the messagecount propertie to retrieve the number of message
in a folder see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_wmiref_pr_Exchange_PublicFolderMessageCount.asp?frame=true.
Exoledb will only run locally on a Exchange server so the code you have
listed would only work locally on a Exchange sever to do this type of
thing remotely look at using WebDAV and doing a propfind on the folder in
question see http://msdn2.microsoft.com/en-us/library/aa142960.aspx .
Any code you run will needs to run in some sort of authenticated context
for WMI you need to use a user that has at least view only Exchange Admin
rights for WebDAV or Exiled the user context the code is running under
will need to have at least read access the folder in question (Although
you can set default and anonymous rights on a folder object there is no
anonymous access to the public folder store so only an authorised exchange
users account will be able to access the properties on any Exchange
object.)
Cheers
Glen
"NuTCrAcKeR" <nutcracker@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:%23ljLDWuHHHA.2632@xxxxxxxxxxxxxxxxxxxxxxx
Is there an easy way ... any small snippet of code, that will allow me to
do
the following:
running in asp, asp.net (1.1, 2.0) from an IIS6 server:
connect to a particular exchange public folder
count the number of messages in the folder
return the count so I can put it on a regular old web page
???
thats it. thats all i want to do. I dont want to know anything about the
items in the folder, just how many there are.
I tried tinkering with the following code, but things arent working ...
<%@language=vbscript %>
<html>
<body>
<%
Set oConnection = CreateObject("ADODB.Connection")
Set oTempRecord = CreateObject("ADODB.Record")
oTempRecord.Open = "http://exchange/public/"
Set oConnection = oTempRecord.ActiveConnection
oConnection.Provider = "EXOLEDB.DataSource"
set oRecords = CreateObject("ADODB.Record")
oRecords.Open http://exchange/public/myfolders/targetfolder, oConnection,
adReadWrite, adOpenIfExists
set oSpam = oRecords.Count
response.Write "This many new items this month: "& oSpam
%>
</body>
</html>
any guidance, direction, functional code ... is greatly appreciated.
thx,
- NuTs
.
- References:
- count items in public folder, from code on webserver
- From: NuTCrAcKeR
- Re: count items in public folder, from code on webserver
- From: Glen Scales [MVP]
- count items in public folder, from code on webserver
- Prev by Date: Re: Problem creating an mailbox through code
- Next by Date: Bulk Import Recipient Policies
- Previous by thread: Re: count items in public folder, from code on webserver
- Next by thread: Re: count items in public folder, from code on webserver
- Index(es):
Relevant Pages
|