You are here: Office-Outlook.com  / Outlook Forum

Walk folder - using cached folders

Home » Outlook addins and plugins development » Outlook forms
Walk folder - using cached folders [message #407495] Fri, 05 September 2008 14:15 Go to next message
Jack
Messages: 158
Registered: August 2006
Senior Member
I have an application that needs to walk through the folders and determine
the folder type (contact, calendar and task) then execute a task

what I am encountering is a large delay when it walks the Exchange based
folders, regardless if the folders are cached or not.

Is there a way to have it walk through the cached folder and not hit the
server every time it does this? The latency is killing me with the current
code, listed below.

for i = 1 To gobjOutlook.Session.Folders.Count
Set MAPIFolder = gobjOutlook.Session.Folders.item(i).Folders.item(j)
blah
next
Re: Walk folder - using cached folders [message #417822] Thu, 11 September 2008 14:45 Go to previous messageGo to next message
Jack
Messages: 158
Registered: August 2006
Senior Member
So,is it more efficient if I navigate multiple folder levels to do:
set Folders = gobjOutlook.Session.Folders
for i = 1 To Folders.Count
Set MAPIFolders = Folders.item(i).Folders
for j=1 to MAPIFodlers.count
...
next
blah
next

But that creates an object manually???

jack


"Dmitry Streblechenko" <dmitry@dimastr.com> wrote in message
news:Oq3EVSeEJHA.5224@TK2MSFTNGP03.phx.gbl...
> Do not use multiple dot notation. For every dot, COM returns a brand new
> object (if that is what the property returns):
>
> set Folders = gobjOutlook.Session.Folders
> for i = 1 To Folders.Count
> Set MAPIFolder = Folders.item(j)
> blah
> next
>
> --
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
> -
> "Jack" <SonomaJack@newsgroups.nospam> wrote in message
> news:OTrWCy5DJHA.1184@TK2MSFTNGP04.phx.gbl...
>>I have an application that needs to walk through the folders and determine
>>the folder type (contact, calendar and task) then execute a task
>>
>> what I am encountering is a large delay when it walks the Exchange based
>> folders, regardless if the folders are cached or not.
>>
>> Is there a way to have it walk through the cached folder and not hit the
>> server every time it does this? The latency is killing me with the
>> current code, listed below.
>>
>> for i = 1 To gobjOutlook.Session.Folders.Count
>> Set MAPIFolder =
>> gobjOutlook.Session.Folders.item(i).Folders.item(j)
>> blah
>> next
>>
>>
>
>
Previous Topic:How can I automate a field (linking it to a drop down)
Next Topic:PublicFolder messages item count is showing zero
Goto Forum: