How to know the folder name

A

Ashish

How to get the folder name in any folder context menu event.
Create a folder under Inbox say folder1. To delete folder1, Select folder
Inbox. Right click on folder1 and select Delete. It will fire delete event
for context menu. In this delete event i can get the button for Delete
action on toolbar. But i do not know for which folder Delete event was
called.
ActiveExplorer->GetCurrentFolder() returns folder Inbox because before
deleting folder1 i select folder Inbox.
Is there any way to know that delete event was called for folder1.
 
K

Ken Slovak - [MVP - Outlook]

Version of Outlook?

If this is Outlook 2007 you can use the
Application.FolderContextMenuDisplay() event to get the folder and its name
from the second argument passed to that event handler.

There's nothing really helpful for earlier versions of Outlook.
 
A

Ashish

If this is Outlook 2007 you can use the
Application.FolderContextMenuDisplay() event to get the folder and its
name from the second argument passed to that event handler.
thanks

There's nothing really helpful for earlier versions of Outlook.

for outlook 2003 is there no way to track it
 
A

Aditi

OutlookInterop.NameSpace olNameSpace = null;
OutlookInterop.MAPIFolder oCalendar = null;
olNameSpace =
ThisAddIn.ApplicationObject.GetNamespace("mapi");
oCalendar =
olNameSpace.GetDefaultFolder(OutlookInterop.OlDefaultFolders.olFolderCalendar);
OutlookInterop.MAPIFolder folder =
ThisAddIn.ApplicationObject.ActiveExplorer().CurrentFolder;
oCalendar.name will do ?
 
K

Ken Slovak - [MVP - Outlook]

No, not really. There are hacks that can be used such as handling deletions
and then checking a list you maintain of existing folders and seeing what's
missing, but the problem is that in Outlook 2003 and earlier you can
right-click on something that's not selected and you never get the context
of what was actually right-clicked.
 
A

Ashish

No, not really. There are hacks that can be used such as >handling
deletions and then checking a list you maintain of >existing folders and
seeing what's missing, b

Do you mean If we maintain a list of folders, after deleting a folder we'll
remove it from list. I am confuse with this solution. The reason is

I found a problem in outlook 2003. If folder1 exist under Inbox and i delete
folder1 then it will go to Deleted Items. But when i check parent folder
name for folder1, outlook still shows it Inbox (not Deleted Items). Outlook
2003 takes 1-2 seconds to change folder name.
 
K

Ken Slovak - [MVP - Outlook]

There's not much you can do about a lag like that, where the cached value is
invalid, if it's not due to unreleased objects. About all you can do is wait
it out.
 

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