How can I detect the folder a mailitem is stored in

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to find out, where a mailitem is stored, that is the folder name
within Outlook. I need that information because I want users to execute an
action only on items from the inbox. Therefore I want to check someting like:
if mailitem.folder is Inbox do... else...
Currently, my code is generating an additional button in each opened mail
(an email that is opened with a doubleclick from within the Inbox). Clicking
this button opens a dialog and runs additional code...
Now I want to avoid this button to show up when an email is opened from lets
say a subfolder of the Inbox.

Hope you can give me hints...
 
MailItem.Parent property will return the parent folder (MAPIFolder).
Do not hardcode the "Inbox" name, or your code will fail in locales other
than English.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Back
Top