WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADSI LDAP CDO
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

CDO Exchange Mailbox size

 Keywords: Mail box Size exchange CDO mailbox

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;   MailboxSize.wbt      by Jay Alverson    April 2003
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;   here's a quick shot at it, I have no way to test it so let me know how it works...

;   BTW the error Messages aren't quite as verbose as the original -- feel free to customize ;)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;   'This script logs on to a server that is running Exchange Server and
;   'displays the current number of bytes that are used in the user's
;   'mailbox and the number of Messages.
;   
;   ' USAGE: call("MailboxSize.wbt", "SERVERNAME MAILBOXNAME")
;   
;   ' This requires that CDO 1.21 is installed on the computer.
;   ' This script is provided AS IS. It is intended as a SAMPLE only.
;   ' Microsoft offers no warranty or support for this script.  
;   ' Use at your own risk.

If param0 <> 2 Then Terminate(@TRUE, "Winbatch CDO Test", 'Usage: call("MailboxSize.wbt", "SERVERNAME MAILBOXNAME")')

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

   IntControl(73, 2, 0, 0, 0)
   error_msg = "Make sure CDO 1.21 is installed."

   oSession = ObjectOpen("MAPI.Session")

   strProfileInfo = StrCat(param1, @LF, param2)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

   IntControl(73, 2, 0, 0, 0)
   error_msg = "Error loggin on."

   oSession.Logon(,,@FALSE, @TRUE,, @TRUE, strProfileInfo)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;   'Grab the information stores.

   IntControl(73, 2, 0, 0, 0)
   error_msg = "Error retrieving InfoStores Collection."

   oInfoStores = oSession.InfoStores
    
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;   'Loop through information stores to find the user's mailbox.

   For istore = 0 To oInfoStores.count-1
      oInfoStore = oInfoStores.item(istore)
      If StrIndexNC(oInfoStore.Name, "Mailbox - ", 1, @FWDSCAN) > 0
         IntControl(73, 2, 0, 0, 0)
         error_msg = "Error retrieving PR_Message_SIZE."
;         '&HE080003 = PR_Message_SIZE
         StorageUsed = oInfoStore.Fields(&HE080003)

         IntControl(73, 2, 0, 0, 0)
         error_msg = "Error Retrieving PR_CONTENT_COUNT."
;         '&H33020003 = PR_CONTENT_COUNT
         NumMessages = oInfoStore.Fields(&H36020003)

         sMsg = StrCat("Storage Used in ", oInfoStore.Name)
         sMsg = StrCat(sMsg , @CRLF,  " (bytes): " , StorageUsed)
         sMsg = StrCat(sMsg, @CRLF, "Number of Messages: ", NumMessages)
         Message("Winbatch CDO", sMsg)
      EndIf
   Next

GoSub CloseUp

Return
Exit

:CloseUp
If IsDefined(oSession)     Then oSession.Logoff
If IsDefined(oInfoStore)    Then ObjectClose(oInfoStore)
If IsDefined(oInfoStores)    Then ObjectClose(oInfoStores)
If IsDefined(oSession)       Then ObjectClose(oSession)
Return


:WBERRORHANDLER

GoSub CloseUp
Terminate(@TRUE, "Winbatch CDO Test", error_msg)

Exit




Article ID:   W17118
File Created: 2007:07:03:14:28:22
Last Updated: 2007:07:03:14:28:22