JScript to Recurse All Outlook Folders and Output Mail Headers?

M

Mark

Hello:


I am really in over my head.


I am trying to make a little application to go through all my Outlook
folders and output just the headers. I can do it by explicitly naming
the folders but I have two problems:


1. I'd prefer to automate it so that it goes through all the folders.
2. I cannot figure out how to make it traverse subfolders or
even explicitly call a subfolder.


In the example below, which works from the command prompt as
"cscript test.js > test.txt" I have it looking in a "Househunt"
folder but that is in the root of the PST file. If I cannot recurse the

folders automatically, how can I explicitly reference a subfolder (i.e.

Househunt\Followup)?


I adapted this script from another I found someplace, but I
am hoping someone can help fill in the blanks.


Thanks


Mark


--


var Wrapper = new ActiveXObject('Mapiprop.MAPIpr­opWrapper');
var olApp = new ActiveXObject('Outlook.Applica­tion');
var olNameSpace = olApp.GetNamespace("MAPI");
var olFolder = olNameSpace.Folders("Old Archives")


Wrapper.Initialize();
var mailItems = olFolder.Folders("Househunt").­Items();
var objItem = mailItems.GetFirst();
do {
var header = Wrapper.GetOneProp(objItem, 0x007D001E);
if (header) {

WScript.Echo("\n"+header+"\n--­---------------------\n");
}
objItem = mailItems.GetNext();
} while (objItem);
Wrapper.Uninitialize();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top