WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE and Outlook
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Find Folder with the String Mailbox


;   this will loop thru all "top level folders" and find
;   the one with "Mailbox - " as part of its name.

;   it should be much safer than prompting for input.

objOutlook = ObjectOpen("Outlook.Application")
oln = objOutlook.GetNameSpace("MAPI")
oln.logon("", "", 0, 1)

For x = 1 To oln.Folders.count
   If StrIndexNC(oln.Folders.item(x).name, "Mailbox - ", 1, @FWDSCAN)
      Message("Debug", oln.Folders.item(x).name)
      MainFolder = oln.Folders.item(x)                   ;<-- top level folder...
      LevelOneFolders = MainFolder.folders            ;<-- folders within folders, etc...
      Inbox = LevelOneFolders.item("Inbox")           ;<-- Inbox
      Break
   EndIf
Next

;   do the rest of the script here...


Exit

Article ID:   W17125
File Created: 2007:07:03:14:28:24
Last Updated: 2007:07:03:14:28:24