when to look for folders? (IMAP, MAPI)

M

matro

hi there,

I want to look for specific folders at Outlook startup.

I have a code which looks for specific folders giving their ID:

Set myFolder = oAppNS.GetFolderFromID(folderID)

this code is fired on the following event:

IDTExtensibility2_OnStartupComplete

this works for POP, but I sometimes have problems with MAPI and often
with IMAP: myFolder contains Nothing even if folderID is a valid MAPI
folder ID.

I think the problem is that IMAP (and sometimes MAPI) folders are not
refreshed with related servers yet, thus they are not ready.

if this is true, my question is: can you tell me *when* I'd be able to
look for folders? is there any event after the OnStartupComplete or
any other valid event?

thank you.

--------

Francesco "Matro" Martire

available at www.realpopup.it:
RealPopup, the freeware winpopup replacer
RealAccount, freeware plugin for MS Outlook XP
MaTreo, freeware frontscreen for your Treo and PalmOS devices
 
K

Ken Slovak - [MVP - Outlook]

Your version of Outlook?

You won't get any events after that. SyncEnd for a SyncObject in the
SyncObjects collection won't work because it only fires if your code
started the synch, not if Outlook starts it.

Have you tried using the StoreId in addition to the EntryID of the
folder?

I can see it with IMAP folders, but for Exchange folders it shouldn't
occur unless you have a very slow connection to your Exchange server.

About the only workaround I can think of is to delay your code by
setting a timer control in OnStartupComplete and working with the
folders when the timer fires. You'd have to play with the settings for
the timer control.
 
M

matro

hi Ken,

thank you for your reply.


Your version of Outlook?

Outlook 2003, but my plugin must work with Outlook XP too.
Have you tried using the StoreId in addition to the EntryID of the
folder?

no, I'll give it a try.
I can see it with IMAP folders, but for Exchange folders it shouldn't
occur unless you have a very slow connection to your Exchange server.

I have to carefully test it: I got same issue of IMAP folders (ie. my
'marking unread' feature doesn't work anymore), but maybe it's not
related.
About the only workaround I can think of is to delay your code by
setting a timer control in OnStartupComplete and working with the
folders when the timer fires. You'd have to play with the settings for
the timer control.

I'll give it a try too... it seems the best workaround for now. I
could implement a sort of 'retry' feature with delays of n seconds and
number of retries.

I'll update this thread. thank you again.

--------

Francesco "Matro" Martire

available at www.realpopup.it:
RealPopup, the freeware winpopup replacer
RealAccount, freeware plugin for MS Outlook XP
MaTreo, freeware frontscreen for your Treo and PalmOS devices
 
K

Ken Slovak - [MVP - Outlook]

If you need the code to work with both you should either develop on an
Outlook 2002 machine or use late binding with no reference set to the
Outlook or Office libraries. That way the code will work on both
versions.

With marking an item read or unread try setting it twice. That's a
glitch that's been around for a while.

I'm not sure if this will help at all but if your main problem is with
Outlook 2003, each item type has a DownloadState property that tells
you if the full item or only headers have been downloaded. You can
also mark an item for download with a number of options. Checking that
might help, I've seen some weird things with items when only headers
were downloaded and/or when cached mode is used. If only headers have
been downloaded you can't get EntryID for example.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top