Re: count items in public folder, from code on webserver

Tech-Archive recommends: Speed Up your PC by fixing your registry



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






.



Relevant Pages

  • Re: Public Folder help
    ... Folder in question and then do a Search on the folder. ... Dim strWinMgmts ' Connection string for WMI ... Dim objWMIExchange ' Exchange Namespace WMI object ...
    (microsoft.public.exchange.development)
  • Re: count items in public folder, from code on webserver
    ... 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 ... remotely look at using WebDAV and doing a propfind on the folder in question ...
    (microsoft.public.exchange.development)
  • RE: Windows server 2003 SP1
    ... Open Exchange System Manager ... check "the database can be overwritten..." ... Do the same for the public folder store ...
    (microsoft.public.windows.server.sbs)
  • Re: Removing Empty, but Replicated Public Folders
    ... You do have Exchange 2003 folders, ... When I go to the E2K7 Server's Public Folder Database, ... it will not let me remove the replicas - ...
    (microsoft.public.exchange.admin)
  • Re: 0x8004011b when trying to download the address book.
    ... I have been troublshooting with a clone of my Exchange, DC, and client boxes on a seperate network. ... Anyway, somehow the planets aligned and with AV shut off completely, PFDAVAdmin to reset the public folder permissions, after running isinteg and eseutil my test setup started working without error and the addressbook downloaded corectly. ... Default DSAccess profile key not found - this is ok. ... Message OAB Name: \Global Address List ...
    (microsoft.public.exchange.clients)