cancel
Showing results for 
Search instead for 
Did you mean: 

Show "simple" attributes of Archived Item

Rob_Wilcox1
Level 6
Partner

 

Here is a little bit of vbscript that will process a mailbox, using CDO, and dump out the attributes of messages :

 

debugon=true
servername="EXCH1"
mailboxname="DOG2"

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 ""
            wscript.echo "Processing : " & oFolder.Name
        end if
       
        t = checkmsgsinfolder(ofolder, objSession)
    next
else
    wscript.echo "No folders to process"
end if

wscript.quit

function checkmsgsinfolder(folder, objsession)
    wscript.echo "Checking folder"
    
    if folder.messages.count > 0 then
        for each omsg in folder.messages
            if debugon = true then
                wscript.echo "...." & omsg.subject
            end if
           
            ' List attributes
            for each afield in omsg.fields
                if afield.name = "Archive ID" or afield.name = "Archived Date" or afield.name = "Saveset ID" or afield.name = "Archive Transation ID" then
                    wscript.echo afield.name & " - " & afield.value
                end if
            next
        next
    else
        wscript.echo "No messages in this folder"
    end if
    
    for each mfolder in folder.folders
        wscript.echo "Sub folder found : " & mfolder.name
        x = checkmsgsinfolder(mfolder, objsession)
    next
    

end function

 

You will need to change the name of the server, and the name of the mailbox.  In addition you might want to change the attributes which get dropped out.

 

The output looks a bit like this :

 

Processing : Inbox
Checking folder
....test123
Archive ID - 1768C4946AF8B964392307250B76EDAFB1110000evault1.EV.Local
Archived Date - 10/7/2010 9:35:20 AM
Saveset ID - 201010076462116~201010071434530000~Z~91053469A23255E1D64E48D627244501
....atest1
Archive ID - 1768C4946AF8B964392307250B76EDAFB1110000evault1.EV.Local
Archived Date - 10/7/2010 9:38:51 AM
Saveset ID - 201010076462327~201010071438240000~Z~91133C64DD687699E837F711678A5FF1
....bongo1
Archive ID - 1768C4946AF8B964392307250B76EDAFB1110000evault1.EV.Local
Archived Date - 10/8/2010 5:29:33 AM
Saveset ID - 201010086533770~201010071439130000~Z~616617E61C8F985F36A8A0F06F4C2A21
....manually archived
Archive ID - 1768C4946AF8B964392307250B76EDAFB1110000evault1.EV.Local
Archived Date - 10/8/2010 5:05:02 AM
Saveset ID - 201010086532299~201010081002580000~Z~6103FC9039C75942458E9D075D846231
....asd
Archive ID - 1768C4946AF8B964392307250B76EDAFB1110000evault1.EV.Local
Archived Date - 10/8/2010 5:26:25 AM
Saveset ID - 201010086533582~201010081026080000~Z~615974C88AA6C70DA8DFE4E79F10E851
....sample signed message
Archive ID - 1768C4946AF8B964392307250B76EDAFB1110000evault1.EV.Local
Archived Date - 10/8/2010 5:31:15 AM
Saveset ID - 201010086533870~201010081026350000~Z~7004A401A70C3CCBF0B55B7744F9B4E1

 

You will also get the (annoying) Outlook pop-up about accessing the address book, just say "yes".