Video Screencast Help

Simple script to list entry ID's

Created: 28 May 2012 • Updated: 08 Jun 2012
Rob.Wilcox's picture
0 0 Votes
Login to vote

I needed a script like this the other day because a log file that I was reviewing contained Entry ID's that I wanted to try and tie back to folder names, or even paths.

The text is below.. save it as a VBSCRIPT, and it will need CDO.  Also you will need to change the Exchange Server name, and mailbox alias for your environment.


Set objSession = CreateObject("MAPI.Session")
objSession.Logon "","",false,true,true,true,servername & vbLF & mailboxname
Set CdoInfoStore = objSession.GetInfoStore
Set CdoFolderRoot = CdoInfoStore.RootFolder

' Start at the very top of the information store
set oFolders = cdoFolderRoot.folders
if ofolders.count > 0 then
    for each ofolder in oFolders
        if debugon = true then
            wscript.echo "Processing : " & oFolder.Name & " : " & ofolder.ID
        end if

        t = checkmsgsinfolder(ofolder, objSession)
    wscript.echo "No folders to process"
end if

wscript.echo ""
wscript.echo "Finished"


function checkmsgsinfolder(folder, objsession)

    for each mfolder in folder.folders
        wscript.echo "Sub folder found : " & & " : " & mfolder.ID
        x = checkmsgsinfolder(mfolder, objsession)

end function