MikeCoop84
Programmer
I was wondering if anyone knows a way of getting to Outlook's Folder object directly, without looping through all of the possible folder names like I've done in the example below.
My code works well, but, we have hundreds of Public Folders in the company. If the Mailbox you're looking for is located after the Public Folders, or you're looking for a Public Folder towards the bottom of the list, it can take several minutes.
oOutlook = CREATEOBJECT("Outlook.Application")
oNameSpace = oOutlook.GetNameSpace("MAPI")
oFolders = oNameSpace.Folders
FOR EACH oFolder IN oFolders
TIA,
Mike
My code works well, but, we have hundreds of Public Folders in the company. If the Mailbox you're looking for is located after the Public Folders, or you're looking for a Public Folder towards the bottom of the list, it can take several minutes.
oOutlook = CREATEOBJECT("Outlook.Application")
oNameSpace = oOutlook.GetNameSpace("MAPI")
oFolders = oNameSpace.Folders
FOR EACH oFolder IN oFolders
lcName = ALLTRIM(oFolder.NAME)
IF 'Search String' $ lcName
loTargetFolder = oFolder
EXIT
ELSE
IF oFolder.Folders.COUNT > 0
*** drill down to sub-folders using this same method
ENDIF
ENDIF
*** STILL HAVE TO EXIT OUTTER LOOP IF FOUND
IF VARTYPE(loTargetFolder) = 'O'
EXIT
ENDIF
ENDFORTIA,
Mike