Deleting/Removing actions from items in Outlook 2003

P

Presi Dente

Hi All,
I'm currently writing an Outlook add-in which uses the context-menu. I add
my custom entry via the Actions.add method like so:

//Define a global Action objectm to hold the current action object
Action globalAction = null;

//Within an explorer selection event...
//Destroy the previous action object...
if(this.globalAction != null){
//delete this custom action
this.globalAction.Delete();
this.globalAction = null;
}

Action tmpAction = null;
//MailItem tmpMailItem;
//...code which set's tmpMailItem

//...create a new Action object
tmpAction = tmpMailItem.Actions.Add();
tmpAction.Name = "BLAH";
tmpAction.ShowOn = OlActionShowOn.olMenu;
tmpMailItem.CustomAction += new
ItemEvents_10_CustomActionEventHandler(this.DoStuff);

//...store the new action in our global variable.
this.globalAction = tmpMailItem;

When the Add-in is unloading either in
"public void OnBeginShutdown(ref Array Custom)"
or in "public void OnDisconnection(Extensibility.ext_DisconnectMode
disconnectMode, ref Array custom)" this occurs
//Delete what should be the last created action
this.globalAction.Delete();
this.globalAction = null;


However, when the add-in is unloaded/uninstalled and outlook is restarted,
the menus are still present. Clicking them only opens the selected item, but
the menu's are still present nonethless.
I've gone thru the VStudio.NET debugger but for the life of me can't work
out when they are being added to the items.

Is there anything obvious I'm missing here?

Thanks for staying this far ;-)

Presi
 
P

Presi Dente

I just needed to call the "save" method on the 'Parent' of the action.

Aaargghh!!!!!!
 

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