How can I detect the folder a mailitem is stored in

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...
 
D

Dmitry Streblechenko

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
 

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