Winscripter
  WSH
  Forums
  Downloads
  Books
  Links
  Amazon




Login
Register

© winscripter.com
1998-2004







Script: MAPI - Get Child Folders of an Inbox

Posted by on Sunday, January 18, 2004 (PST)

Script: Using MAPI, display a list of subfolders of an Inbox.

 

/**
 *    Script:   getChildFolderNames.js
 *    Purpose:  Opens the Inbox for the Outlook profile defined
 *              and displays all the child folders to the user.
 * 
 *    Author:   Daren Thiel
 *    Date:     24 November 1998
 *
 *    Note:     If the message are large the WScript.Echo box will
 *              be larger than the screen area.  By default the OK
 *              button is selected, so pressing enter will clear the
 *              popup from view. Recommend using cscript to execute.
 *    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;
function ListFolders( objParent, fIndex )
{
 var name = "";
  name = objParent.Item(fIndex).Name;
  return name;
}
 
objFold = objFolder.Folders;
mCount = objFold.Count;
WScript.Echo( mCount );
name = "";
for ( i = 1; i < mCount + 1; i++ )
{
 name += "Inbox\\" + ListFolders( objFold, i ) + "\n";
}

WScript.Echo( name );

 



WSH and ADSI Administrative Scripting

New Articles
  • List installed COM objects and associated ProgIDs
    Script: Lists all COM Objects and their associated ProgIDs (If available). Win32_ClassicCOMClassSetting

  • Script: File Rotator
    Script: Rotate files where the most current file has the lowest number in the archive. When files exceed the retention period, they are deleted. Typically used for log files, backups, etc..

  • Script: Create IIS Website and DNS record
    Script: Dan Casier sent me this script that will create a website and appropriate DNS record. The script is intended for Windows 2000 Server with local DNS and necessary DNS mof installed.


  • Winscripter   |  WSH   |  Forums   |  Downloads   |  Books   |  Links   |  Amazon