Refresh outlook folders after mailAdd event fires

M

MooseMan

I have developed an add in(plug in) for Outlook 2003 using VSTO and c# .net
2005.
The addin captures all incoming emails and processes them. As they are
processed, I update
ewMail.FlagStatus = Outlook.OlFlagStatus.olFlagComplete which tells me the
email was processed. This is also a good visual for the customer to see that
the add in is working. The flag does not get refreshed on the form unless you
reselect the inbox folder. Is there any way to refress the outlook folder
from an outlook add in?
 
K

Ken Slovak - [MVP - Outlook]

Only by making another folder current and then going back again.
 
M

MooseMan

How can I access the main form from the add in? Right now I have a reference
to the folders via the following command
Outlook.MAPIFolder me = mapiNamespace.GetDefaultFolder(
Outlook.OlDefaultFolders.olFolderOutbox ) as Outlook.MAPIFolder;

Any help would be greatly appreciated, Ken.
 
K

Ken Slovak - [MVP - Outlook]

What main form?

Your reference is to the Outbox, however you shouldn't be messing with items
in the Outbox..

Let's say you have 2 folder references: folder A and folder B, A is the
current folder and Outlook.Application is oApp.

Outlook.Explorer exp = oApp.ActiveExplorer(); //get ActiveExplorer
exp.CurrentFolder = B;
exp.CurrentFolder = A;

That moves the focus from A to B and back again.
 
M

MooseMan

Ken, tks for the input.
By 'main form; I meant the current folder.
I am processing events from the inbox folder.
To solve the problem I performed the following code:

Outlook.Application oApp;
oApp= mapiNamespace.Application;
Outlook.Explorer exp = oApp.ActiveExplorer(); //get
ActiveExplorer

exp.CurrentFolder = Holdme;
exp.CurrentFolder = inbox;

of course mapiNamespace,Holdme(pointer to SendItems), and inbox were
instantiated when the dll was loaded within default constructor.

Thanks Ken for all your valued help!
 

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