A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How can I detect the folder a mailitem is stored in



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 1st 07, 05:26 PM posted to microsoft.public.outlook.program_vba
Harald W.
external usenet poster
 
Posts: 2
Default How can I detect the folder a mailitem is stored in

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...
Ads
  #2  
Old November 1st 07, 05:58 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default How can I detect the folder a mailitem is stored in

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

"Harald W." wrote in message
...
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...



  #3  
Old November 2nd 07, 12:00 PM posted to microsoft.public.outlook.program_vba
Harald W.
external usenet poster
 
Posts: 2
Default How can I detect the folder a mailitem is stored in

Thanx a lot!
Sometimes, you do not even find the easiest solutions...



"Dmitry Streblechenko" wrote:

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

"Harald W." wrote in message
...
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...




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy a Mailitem to public folder after being sent Niclas Outlook and VBA 5 June 14th 07 09:27 AM
How to Add a MailItem to a Folder Ron Outlook and VBA 2 January 10th 07 09:53 PM
Where are Local Folder E-mails Stored? illinifan1985 Outlook Express 4 July 9th 06 06:34 PM
MailItem Folder Path Fox via OfficeKB.com Outlook and VBA 1 July 7th 06 03:39 PM
OE6 'stored folder' problem Aya Outlook Express 3 April 26th 06 02:52 AM


All times are GMT +1. The time now is 12:55 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.