msgbox "Searching Outlook for certain attachments . . ."
'
' First the sub-routine that looks through a specified folder looking for mail
' items and attachments
'
sub LookThroughFolder (thisFolder)
if thisFolder.Count > 0 then
set myItem = thisFolder.GetFirst
' msgbox "IN FOLDER: " & myItem.parent & " ARE " & thisFolder.count & " ITEMS. FIRST ONE IS: " & myItem
'
' Step through all items in that Folder
'
for k = 1 to thisFolder.count
if myItem.class = "43" then
if myItem.attachments.count > 0 then
'
' For any mail item (class 43) with an attachment, check its name
'
if myItem.Attachments(1) > "15" and myItem.Attachments(1) < "17" then
msgbox "FOUND IN = " & myItem.Parent & "(IN: " & myitem.parent.parent & ")" & ". SUBJECT = " & myItem & ". ATTACHMENT = " & myItem.Attachments(1)
end if
end if
end if
'
' Now look at the next item in the folder
'
set MyItem = thisfolder.GetNext
next
end if
end sub
'
' Now for the actual code, that steps through your mailbox and .PSTs...
'
set ol = getobject(,"outlook.application")
set mapi=ol.getnamespace("MAPI")
'
' Step through all folders in your profile
'
for i = 1 to mapi.folders.count
'
' Ignore the Public Folders
'
if mapi.folders(i) <> "Public Folders" then
set myStore = mapi.folders(i)
rtn = msgbox ("Store = " & myStore, 1)
if rtn <> 2 then
set myFolders = myStore.folders
'
' Step through all folders in that Store
'
for j = 1 to myFolders.Count
LookThroughFolder (myFolders(j).Items)
set mySubFolders = myFolders(j).folders
for m = 1 to mySubFolders.count
'
' If we have any sub-folders, look through those.
'
LookThroughFolder (mySubFolders(m).items)
set mySubSubFolders = mySubFolders(m).folders
for n = 1 to mySubSubFolders.count
'
' If we have any sub-folders of those sub-folders, look through those.
'
LookThroughFolder (mySubSubFolders(n).items)
next
next
next
end if
end if
next
Msgbox "Ending the search . . ."