How to judge what folder the specified entry id is?

Status
Not open for further replies.
R

ryotyankou

I scaned all message store to search folders and add them to a tree with

checkbox. user can select what folder to do deal with, i want to set

different icon to the tree item. I have icon for inbox, outbox, sent items

and so on. So i want to know what kind of MAPIFolder is, for the default

message store, it is esay to know this while use GetDefaultFolder, for other

message store like hotmail, i tried a way, it worked fine, but when i add

hotmail account via outlook connector(from microsoft), it not work any more.

My method is:

1. use NameSpace::GetDefaultFolder get the folder.

2. Get name of the default folder and save it to a map.

3. do 1,2 to get other folder string, inbox, outbox(...etc.)

4. for no default message store, check their name if existed in the map, if

does, return id will show which kind it is.

Hotmail(via outlook connector) is not work, because some string are english,

such inbox, sent items, some are local language, such as chinese string of

"outbox".

Any ideas? If i want to check the folder's(MAPIFolder) type?

 
GetDefaultFolder will only work with certain folders in your default mail

store (where emails are delivered). I'm not familiar at all with the Outlook

connector, but if it shows folders in Outlook it most likely is mimicking a

PST file. In that case you can iterate the Stores collection in Outlook 2007

or NameSpace.Folders in earlier versions to get all opened stores. From

there you can get folders and each folder is a MAPIFolder, where you can

check on the DefaultItemType property to see what type of folder it is.

"ryotyankou " <u48591@uwe> wrote in message

news:96a564faae503@uwe...
> I scaned all message store to search folders and add them to a tree with
> checkbox. user can select what folder to do deal with, i want to set
> different icon to the tree item. I have icon for inbox, outbox, sent items
> and so on. So i want to know what kind of MAPIFolder is, for the default
> message store, it is esay to know this while use GetDefaultFolder, for
> other
> message store like hotmail, i tried a way, it worked fine, but when i add
> hotmail account via outlook connector(from microsoft), it not work any
> more.
> My method is:
> 1. use NameSpace::GetDefaultFolder get the folder.
> 2. Get name of the default folder and save it to a map.
> 3. do 1,2 to get other folder string, inbox, outbox(...etc.)
> 4. for no default message store, check their name if existed in the map,
> if
> does, return id will show which kind it is.
> Hotmail(via outlook connector) is not work, because some string are
> english,
> such inbox, sent items, some are local language, such as chinese string of
> "outbox".
> Any ideas? If i want to check the folder's(MAPIFolder) type?

> >
>
 
Hi, ken, that's not exactly what i want, DefaultItemType is only show me what

kind of item the folder will hold, MailItem, appointment, contact. I want to

set the CTreeCtrl item's icon, and this item is a MAPIFolder, so i want to

know it's kind, the kind include "inbox, outbox, sent items, deleted items,

junk e-mails, drafts."

My method not work because the string is not always the same language, my

local system(XP pro) is Chinese system, but my hotmail account registered

using English info. So the folder names are all in a muddle. Some are

English and others are Chinese. This is special case, normally all message

store folders in my outlook are Chinese.
- wrote:
> GetDefaultFolder will only work with certain folders in your default mail
> store (where emails are delivered). I'm not familiar at all with the Outlook
> connector, but if it shows folders in Outlook it most likely is mimicking a
> PST file. In that case you can iterate the Stores collection in Outlook 2007
> or NameSpace.Folders in earlier versions to get all opened stores. From
> there you can get folders and each folder is a MAPIFolder, where you can
> check on the DefaultItemType property to see what type of folder it is.
>
> >I scaned all message store to search folders and add them to a tree with
> > checkbox. user can select what folder to do deal with, i want to set

> [quoted text clipped - 17 lines]
> > "outbox".
> > Any ideas? If i want to check the folder's(MAPIFolder) type?



 
Well, you can only use GetDefaultFolder() with folders in your default mail

store (where email is delivered for that Outlook profile). So that method

won't help you at all for non-default stores.

If you use a MAPI viewer such as OutlookSpy you can see that on the Store

object (IMsgStore button) in any open store there are properties there that

contain the folder EntryID's of certain default folders:

PR_IPM_OUTBOX_ENTRYID 0x35E20102

PR_SENTMAIL_ENTRYID 0x35E40102

PR_IPM_WASTEBASKET_ENTRYID 0x35E30102

Those contain the EntryID's for respectively the Outbox, Sent Items and

Deleted Items folders.

Then in the Inbox (IMAPIFolder button) there are:

PR_IPM_APPOINTMENT_ENTRYID 0x36D00102

PR_IPM_CONTACT_ENTRYID 0x36D10102

PR_IPM_DRAFTS_ENTRYID 0x36D70102

PR_IPM_JOURNAL_ENTRYID 0x36D20102

PR_IPM_NOTE_ENTRYID 0x36D30102

PR_IPM_TASK_ENTRYID 0x36D40102

Those are for the Calendar, Contacts, Drafts, Journal, Notes and Tasks

default folders.

You can read those properties from the Store, navigate down through

PR_IPM_SUBTREE_ENTRYID (0x35E00102) and get to the visible folders where you

can check each folder in that hierarchy for a folder that has the Calendar,

etc. properties, that's the Inbox.

That will tell you what you want I think, but to do those operations you

would need to be using Outlook 2007 or in earlier versions of Outlook using

an alternate API such as Extended MAPI, CDO 1.21 or Redemption

(www.dimastr.com/redemption). Then for other folders you fall back to

DefaultItemType to get the folder types.

You also have to be careful about comparing EntryID's, you can't just test

them for string or binary array equality. You should use one of the

CompareID's methods using those other API's or Outlook 2007.

"ryotyankou " <u48591@uwe> wrote in message

news:96aec03122aa6@uwe...
> Hi, ken, that's not exactly what i want, DefaultItemType is only show me
> what
> kind of item the folder will hold, MailItem, appointment, contact. I want
> to
> set the CTreeCtrl item's icon, and this item is a MAPIFolder, so i want to
> know it's kind, the kind include "inbox, outbox, sent items, deleted
> items,
> junk e-mails, drafts."
> My method not work because the string is not always the same language, my
> local system(XP pro) is Chinese system, but my hotmail account registered
> using English info. So the folder names are all in a muddle. Some are
> English and others are Chinese. This is special case, normally all message
> store folders in my outlook are Chinese.
>
 
The omnly way to do that is to read the MailItem.Parent property which

returns the parent MAPIFolder object.

Or you can read the PR_PARENT_ENTRYID MAPI property.

Dmitry Streblechenko (MVP)

-

"ryotyankou " <u48591@uwe> wrote in message

news:96a564faae503@uwe...
> I scaned all message store to search folders and add them to a tree with
> checkbox. user can select what folder to do deal with, i want to set
> different icon to the tree item. I have icon for inbox, outbox, sent items
> and so on. So i want to know what kind of MAPIFolder is, for the default
> message store, it is esay to know this while use GetDefaultFolder, for
> other
> message store like hotmail, i tried a way, it worked fine, but when i add
> hotmail account via outlook connector(from microsoft), it not work any
> more.
> My method is:
> 1. use NameSpace::GetDefaultFolder get the folder.
> 2. Get name of the default folder and save it to a map.
> 3. do 1,2 to get other folder string, inbox, outbox(...etc.)
> 4. for no default message store, check their name if existed in the map,
> if
> does, return id will show which kind it is.
> Hotmail(via outlook connector) is not work, because some string are
> english,
> such inbox, sent items, some are local language, such as chinese string of
> "outbox".
> Any ideas? If i want to check the folder's(MAPIFolder) type?

> >
>
 
Thank you for your relpy, Dmitry.

For a mail store, to get entry id for folders:

Inbox: GetReceiveFolder

Outbox: PR_IPM_OUTBOX_ENTRYID

Sent: PR_IPM_SENTMAIL_ENTRYID

Junk: PR_IPM_WASTEBASKET_ENTRYID

// then open PR_IPM_SUBTREE_ENTRYID to get others

Draft: PR_IPM_DRAFTS_ENTRYID

> .. Am i right?

But how about the deleted items folder? I couldn't find it in outlook spy.

Dmitry Streblechenko wrote:
> The omnly way to do that is to read the MailItem.Parent property which
> returns the parent MAPIFolder object.
> Or you can read the PR_PARENT_ENTRYID MAPI property.
>
> >I scaned all message store to search folders and add them to a tree with
> > checkbox. user can select what folder to do deal with, i want to set

> [quoted text clipped - 17 lines]
> > "outbox".
> > Any ideas? If i want to check the folder's(MAPIFolder) type?



 
I found my errors, correct ones should be:

Inbox: IMsgStore::GetReceiveFolder

Outbox: PR_IPM_OUTBOX_ENTRYID

Sent: PR_IPM_SENTMAIL_ENTRYID

Deleted: PR_IPM_WASTEBASKET_ENTRYID

// then open PR_IPM_SUBTREE_ENTRYID to get draft and other like note,

appointment, etc.

Draft: PR_IPM_DRAFTS_ENTRYID

> ..

Junk: PR_ADDITIONAL_REN_ENTRYIDS, which specify its entry value as 4

will get junk folder.

--------------------My question now changed to:

How to do with PR_ADDITONAL_REN_ENTRYIDS to get junk folder, what should i

pass in IMAPISession::OpenEntry?

 
It's OK now, after search through the internet and many tries, all worked now,

thanks for your help, Dmitry.

ryotyankou wrote:
> I found my errors, correct ones should be:
> Inbox: IMsgStore::GetReceiveFolder
> Outbox: PR_IPM_OUTBOX_ENTRYID
> Sent: PR_IPM_SENTMAIL_ENTRYID
> Deleted: PR_IPM_WASTEBASKET_ENTRYID
> // then open PR_IPM_SUBTREE_ENTRYID to get draft and other like note,
> appointment, etc.
> Draft: PR_IPM_DRAFTS_ENTRYID
> ...
> Junk: PR_ADDITIONAL_REN_ENTRYIDS, which specify its entry value as 4
> will get junk folder.
> --------------------------------------------------> My question now changed to:
> How to do with PR_ADDITONAL_REN_ENTRYIDS to get junk folder, what should i
> pass in IMAPISession::OpenEntry?



 
Deleted Items: PR_IPM_WASTEBASKET_ENTRYID

(not Junk)

"ryotyankou " <u48591@uwe> wrote in message

news:96e205e77a776@uwe...
> Thank you for your relpy, Dmitry.
> For a mail store, to get entry id for folders:
> Inbox: GetReceiveFolder
> Outbox: PR_IPM_OUTBOX_ENTRYID
> Sent: PR_IPM_SENTMAIL_ENTRYID
> Junk: PR_IPM_WASTEBASKET_ENTRYID
> // then open PR_IPM_SUBTREE_ENTRYID to get others
> Draft: PR_IPM_DRAFTS_ENTRYID
> .. Am i right?
> But how about the deleted items folder? I couldn't find it in outlook spy.

> Dmitry Streblechenko wrote:
> >The omnly way to do that is to read the MailItem.Parent property which
> >returns the parent MAPIFolder object.
> >Or you can read the PR_PARENT_ENTRYID MAPI property.
> >
> >>I scaned all message store to search folders and add them to a tree with
> >> checkbox. user can select what folder to do deal with, i want to set

> >[quoted text clipped - 17 lines]
> >> "outbox".
> >> Any ideas? If i want to check the folder's(MAPIFolder) type?


> >
>
>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
M Search message, then (1) Jump to folder & (2) Select message that you searched for Outlook VBA and Custom Forms 2
G Search Folders and Jump to Folder Outlook VBA and Custom Forms 2
X Run macro automatically when a mail appears in the sent folder Using Outlook 5
P Can't add custom field to custom Outlook form, it always adds to the Folder instead Outlook VBA and Custom Forms 2
P Yahoo/IMAP folder rename by Outlook desktop 365 Using Outlook 0
A Outlook 2019 folder counter Using Outlook 0
A Search folder and move the email Outlook VBA and Custom Forms 0
N Reply to Outlook messages by moving messages to a specific Outlook folder Outlook VBA and Custom Forms 1
T How to find or display the sub-folder name for an Archive Search Using Outlook 10
A Outlook 365 (OutLook For Mac)Move "On My Computer" Folder Items From Old To New Mac Computer Using Outlook 3
P Search folder: all emails sent to or from a domain Using Outlook 1
V Folder Properties - Gmail account can't switch Using Outlook 5
Victor_50 Outlook 2019 Jump to folder from search folder Outlook VBA and Custom Forms 0
HarvMan Outlook 365 - Rule to Move an Incoming Message to Another Folder Using Outlook 4
S Email Macros to go to a SHARED Outlook mailbox Draft folder...NOT my personal Outlook Draft folder Using Outlook 2
I Help with Smart Folder + Query Builder on IMAP Using Outlook 0
S Paperclip icon shows without attachment in email under Sent folder Using Outlook 0
Kika Melo Outlook Calendar deleted appointments not in Deleted Items folder Using Outlook 3
K vba code to auto download email into a specific folder in local hard disk as and when any new email arrives in Inbox/subfolder Outlook VBA and Custom Forms 0
Z Outlook 365 Automatically assign categories to incoming mail in a shared folder Round Robin Outlook VBA and Custom Forms 1
G Adding a contact to a specific folder Using Outlook 0
Witzker Outlook 2019 Macro GoTo user defined search folder Outlook VBA and Custom Forms 6
Rupert Dragwater Duplicate email in Folder Using Outlook 7
S Adding a recipient's column to Sent folder in Outlook 2010 Outlook VBA and Custom Forms 1
L "Insert Pictures" Button-Wrong Folder Using Outlook 5
C Outlook 365 Copy/Save Emails in Folder Outside Outlook to Show Date Sender Recipient Subject in Header Using Outlook 0
CWM550 Outlook 365 Hey Diane! MS 365 Biz Standard and "Potential Spam" addressed to others coming to my JUNK folder? Using Outlook 2
J Quick steps delete original email and move reply/sent email to folder Using Outlook 2
A manual rule sends mail to wrong folder Using Outlook 5
richardwing Auto forward email that is moves into a specific outlook folder Outlook VBA and Custom Forms 5
D This folder up to date vs all folders up to date Using Outlook 1
G Automatically delete messages in the synchronization folder Outlook VBA and Custom Forms 3
wayneame Changing the Form Used by Existing Task Items in a Folder Outlook VBA and Custom Forms 4
S Need code to allow defined starting folder and selection from there to drill down Outlook VBA and Custom Forms 10
P Emails assigned with a certain category (within a shared inbox) to be copied to a specific folder. Outlook VBA and Custom Forms 2
M Saving emails using Visual Basic - Selecting folder with msoFileDialogFolderPicker Outlook VBA and Custom Forms 6
B Search and Find Email by Folder Name Outlook VBA and Custom Forms 2
S Folder Pane Colour Categories Using Outlook 6
Victor.Ayala Automated way to check the option "Show this folder as an email Address Book" Outlook VBA and Custom Forms 2
NVDon Create new Move To Folder list Outlook VBA and Custom Forms 0
M Extract "Date sent" from emails (saved to folder using drag and drop) Outlook VBA and Custom Forms 1
O Cannot expand the folder. The set of folders cannot be opened. You do not have permission to log on. Using Outlook 1
F Jump to Inbox folder when click on Favorite Using Outlook 8
P Print attachments automatically and move the mail to an existing folder called "Ted" Outlook VBA and Custom Forms 4
lcarpay Stay in the mail folder pane after ctrl-1 Using Outlook 1
T Macro to move reply and original message to folder Outlook VBA and Custom Forms 6
F VBA to move email from Non Default folder to Sub folders as per details given in excel file Outlook VBA and Custom Forms 11
bhamberg Shortcuts in Folder Pane (Outlook 2016) Using Outlook 19
G VBA to save selected Outlook msg with new name in selected network Windows folder Outlook VBA and Custom Forms 1
P Posts in Folder No Longer Group by Conversation Column After Search Using Outlook 0

Similar threads

Back
Top