Looking for some suggestions/comments/whatever on the three UDFs below.
They are the result of this post and are inspired by Hey scripting guy link 1 and Hey scripting guy link 2.

I had a project at work that required getting the size of one specific subfolder of every user's inbox and this resulted in the UDFs below.

Enumerate first level subfolders:
 Code:
;Function	EnumOutlookFolders()
;
;Authors:	Mart
;
;Action:
;		Gets the subfolders of a specified outlook folder
;
;Syntax:
;Function	EnumOutlookFolders()
;
;Version:
;		1.0 February 26th 2013
;			Initial post
;
;Parameters:
;		Folder
;			3 = Deleted items
;			4 = Outbox
;			5 = Sent Items
;			6 = Inbox
;			9 = Calendar
;			10 = Contacts
;			11 = Journal
;			12 = Notes
;			13 = Tasks
;
;Returns:
;		Array with names of first level subfolders
;
;Dependencies
;		Outlook
;		Developed and tested with Outlook 2010
;
;KiXtart:
;		Developed on KiXtart 4.62
;
;Example(s):
;		Break on
;
;		$folderID = 6
;		$mysubfolders = EnumOutlookFolders($folderid)
;		For Each $mysubfolder in $mysubfolders
;			? $mysubfolder
;		Next
;
;Code:
Function EnumOutlookFolders($folderid)
	$outlook = CreateObject("Outlook.Application")
	$namespace = $outlook.GetNamespace("MAPI")
	$parentfolder = $namespace.GetDefaultFolder($folderid)
	$subfolders = $parentfolder.Folders

	$index = 0
	For Each $subFolder in $subfolders
		ReDim preserve $EnumOutlookFolders[$index]
		$EnumOutlookFolders[$index] = $parentfolder.Folders($subfolder.Name)
		$index = $index + 1	
	Next
EndFunction


Get number of items in specified folder:
 Code:
;Function	GetOutlookItems()
;
;Authors:	Mart
;
;Action:
;		Gets the number of items in a specified outlook folder
;
;Syntax:
;Function	GetOutlookItems()
;
;Version:
;		1.0 February 22nd 2013
;			Initial post
;
;Parameters:
;		Folder
;			3 = Deleted items
;			4 = Outbox
;			5 = Sent Items
;			6 = Inbox
;			9 = Calendar
;			10 = Contacts
;			11 = Journal
;			12 = Notes
;			13 = Tasks
;
;Returns:
;		Number of items
;
;Dependencies
;		Outlook
;		Developed and tested with Outlook 2010
;
;KiXtart:
;		Developed on KiXtart 4.62
;
;Example(s):
;		Break on
;
;		$folderID = 6
;		$itemcount = GetOutlookItems($folderID)
;		?$itemcount
;
;Code:
Function GetOutlookItems($folderID)
	$outlook = CreateObject("Outlook.Application")
	$namespace = $outlook.GetNamespace("MAPI")

	$folder = $namespace.GetDefaultFolder($folderID)
	$items = $folder.Items
	$GetOutlookItems = $items.Count
EndFunction


Get size of spcified first level sub folder:
 Code:
;Function	GetOLFolderSize()
;
;Authors:	Mart
;
;Action:
;		Gets the size of a first level outlook sub folder
;
;Syntax:
;Function	GetOLFolderSize()
;
;Version:
;		1.0 February 26th 2013
;			Initial post
;
;Parameters:
;		parentfolder
;			3 = Deleted items
;			4 = Outbox
;			5 = Sent Items
;			6 = Inbox
;			9 = Calendar
;			10 = Contacts
;			11 = Journal
;			12 = Notes
;			13 = Tasks
;
;		Target
;			Any first level sub folder of the available parent folders
;
;Returns:
;		Array containing folder name, number of items, folder size in KB
;
;Dependencies
;		Outlook
;		Developed and tested with Outlook 2010
;
;KiXtart:
;		Developed on KiXtart 4.62
;
;Example(s):
;		Break On
;
;		$parentfolder = 6
;		$subfolder = "My mail folder"
;		$rc = GetOLFolderSize($parentfolder, $subfolder)
;
;		? $rc[0]
;		? $rc[1]
;		? $rc[2]
;
;		Sleep 5
;
;Code:
Function GetOLFolderSize($parentfolder, $subfolder)
	;Declare variables
	Dim $MyArray[2], $objoutlook, $objnamespace, $folder
	Dim $folders, $objsubfolder, $objfolder, $colitems
	Dim $objitem, $intsize

	;Create Outlook object
	$objOutlook = CreateObject("Outlook.Application")
	;Get Outlook namespace
	$objNamespace = $objOutlook.GetNamespace("MAPI")
	;Connect to parent folder
	$folder = $objNamespace.GetDefaultFolder($parentfolder)
			
	;Enumerate sub folders of parent folder
	$folders = $folder.Folders
	;Loop trought all folders
	For Each $objfolder in $folders
		;Get sub folder name
		$objsubfolder = $folder.Folders($objfolder.Name)
		
		If $objsubfolder = $subfolder
			$myarray[0] = $objfolder.Name
			$colitems = $objfolder.Items
			$myarray[1] = $colitems.Count
			For Each $objitem in $objfolder.Items
				$intsize = CInt($intsize) + $objitem.Size
			Next
			$myarray[2] = CInt($intsize) /1024
		EndIf
	Next

	$getolfoldersize = $myarray
EndFunction
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.