; -- Pieces stolen from - http://cwashington.netreach.net/depo/view.asp?Index=445&ScriptType=vbscript
; -- You will need to have CDO.DLL installed too..BREAK ON CLS
Dim CdoPR_ACCOUNT
CdoPR_CONTAINER_CLASS = &H3613001E
$OL = CreateObject("outlook.Application")
$mapi=$ol.getnamespace("mapi")
? $mapi
$inbox=$mapi.getdefaultfolder(6)
? $inbox
$count=$inbox.items.count
? $count
$size=$inbox.object.Size
? $size
$first=$inbox.items(1).subject
? $first
$intCounter = 1
; Loop through the infostores
For $intCounter = 1 To $mapi.InfoStores.Count
;' Check if we have not hit the public information store
If Trim(UCase($mapi.Infostores.Item($intCounter).Name)) <> "PUBLIC FOLDERS" Then
;Get the root folder
$objRootFolder = $mapi.Infostores.Item($intCounter).RootFolder
;Get the folder collection
$objFoldersColl = $objRootFolder.Folders ;Folders collection
;Wscript.Echo objFoldersColl.count
If $objFoldersColl <> "" Then
; get the first folder in the collection
$objOneFolder = $objFoldersColl.GetFirst
?$objOneFolder.name
;loop through all the folders in the collection
Do While $objOneFolder <> ""
; Check all messages in this folder
; is it a Mail Item folder?
$objFields = $objOneFolder.Fields
$strFolderType = $objFields.Item(CdoPR_CONTAINER_CLASS)
If $strFolderType = "IPF.Note" Then
$objFields = ""
;check all subfolders also
$size=$inbox.object.Size ; -- Get the current folder size
$fldrsize = $size ; -- Set it to a computed global variable
$ttlsize = $size+$ttlsize
? $size+" of Folder"
? $ttlsize+" Total"
EndIf
$objOneFolder = $objFoldersColl.GetNext
Loop
EndIf
; Add the results to the report text
;? strUserName
EndIf
Next