/**
* Script: ol98InboxSize.js
* Purpose: Opens the Inbox for the Outlook profile defined
* adds the sizes all messages and shows total to user.
* Author: Daren Thiel
* Date: 24 November 1998
*
* Note: This script will only find the total for messages
* in the inbox, no Inbox child folders will be looked at.
* Web: http://www.winscripter.com
**/
/* Set the name of the profile to use */
var profile = "Microsoft Outlook Internet Settings";
/* Create a MAPI Session Object */
omapi = new ActiveXObject( "MAPI.Session" );
/* Open the profile of where we want to store the address */
omapi.Logon( profile );
/* Create an object for the Inbox of this profile */
objFolder = omapi.Inbox;
/* Create an object for the Messages */
objMsg = objFolder.Messages;
var mSize = 0; // Counter to store sum of message sizes
var mCount = objMsg.Count; // Get the number of messages
/* Loop through all the messages and add their size to the total */
for ( i = 1; i < mCount; i++ )
{
msg = objMsg.Item(i);
mSize += msg.Size;
}
/* The total stored in mSize is in Bytes */
/* I will conver to KB for easy reading */
mSize = Math.round( mSize / 1024 );
/* Display what we found to the user */
var results = "Total number of messages = " + mCount + "\n";
results += "Size of Inbox = " + mSize + " KB";
WScript.Echo( results );