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?

 
K

Ken Slovak - [MVP - Outlook]

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?

> >
>
 
R

ryotyankou

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?



 
K

Ken Slovak - [MVP - Outlook]

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

Dmitry Streblechenko

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?

> >
>
 
R

ryotyankou

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?



 
R

ryotyankou

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?

 
R

ryotyankou

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?



 
K

Ken Slovak - [MVP - Outlook]

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.
Thread starter Similar threads Forum Replies Date
J Moved many emails to Outlook external folder, need to delete on Gmail server Using Outlook 13
A Going to folder using shortcuts Using Outlook 3
B Outlook 2016 Auto-archive creates new folder Using Outlook 4
B BCC issues after changing root folder path for gmail Using Outlook 1
Fozzie Bear Outlook 2016 Creating a shared local Contacts folder Using Outlook 2
A Cannot copy this folder because it may contain private items Using Outlook 0
A Unable to save recurring Meeting to Documents folder due to error Using Outlook 2
B Extracting email addresses from a folder - how to also get the name of the person the address is for? Using Outlook 5
E How to display "Change Folder" in Change Default Email Delivery Location in Exchange Outlook 2016 Using Outlook 1
J Moving Imported folder Using Outlook 2
R List folders in a combo box + select folder + move emails from inbox to that folder + reply to that email Outlook VBA and Custom Forms 1
J Sent Items Folder NOT Showing Correct From Email Address Using Outlook 0
B VBA to Collapse Task Folder Groups Outlook VBA and Custom Forms 1
Retired Geek Junk Folder Clean Up Rules Exchange Server Administration 1
D Outlook 2016 Deleting emails without affecting folder structure - Outlook Office 365 Using Outlook 3
B Outlook 365 - Folder pane list clears Using Outlook 24
P Add, remove, & reorder folder pane Using Outlook 6
R Folder pane width change Using Outlook 48
T Missing Folder in Outlook.com Using Outlook 3
R Setup autofoward rule on a particular folder in Outlook Using Outlook 0
T After I send a new email, it remains in the Draft folder Using Outlook.com accounts in Outlook 3
N Outlook 2016 Folder Icons Look Using Outlook 0
S Create A Search Folder That Looks For Message Class? Outlook VBA and Custom Forms 0
R Deleting emails from storage folder Outlook VBA and Custom Forms 1
B Outlook - Mail from safe senders list being sent to Spam Folder Using Outlook 0
R Search/Jump to a folder by typing its name Outlook VBA and Custom Forms 1
M Sent mail not showing in Sent Items folder; but they can be found with Search Using Outlook 3
A Create date folder and move messages daily Outlook VBA and Custom Forms 1
9 Outlook 2016 How to save an Outlook attachment to a specific folder then delete the email it came from? Using Outlook 1
R VBA for copying sent email to current folder under a shared mailbox Outlook VBA and Custom Forms 17
W Looks like the folder below has been deleted: "iCloud\Calendar" Using Outlook 1
T "cannot find the calendar folder for this item" - calendar items stuck in outbox Using Outlook 0
R "Can't store Outlook data files under the AppData folder. Please choose another folder." Using Outlook 6
H Return Highest Level Email Folder Outlook VBA and Custom Forms 2
E Project Management - Adding Folders for Different Folder Types Using Outlook.com accounts in Outlook 0
G Can't create Folder Groups in Outlook 2013 Using Outlook 0
C Can't move folder, the folder is full Using Outlook 0
geofferyh Outlook 2010 How to Copy Outlook Attachment to a Specific Folder? Outlook VBA and Custom Forms 3
R Can not create folder to store specific emails in in Outlook for Mac Using Outlook 1
B Clear Offline Items (Mail Folder) via VBA Outlook VBA and Custom Forms 1
V Emails remain in Drafts folder even though they have been sent Using Outlook 4
M Moving mail to another folder is much slower than before (Office365) Using Outlook 0
D.Moore Folder view settings by VBA macro Outlook VBA and Custom Forms 57
W Create Search Folder excluding Specific Email Addresses Using Outlook 5
N Lots of Folder in Outlook Android Using Outlook 2
O Rule to move (specific) messages from Sent folder to Specific folder Using Outlook 1
A Outlook macro to create search folder with mail categories as criteria Outlook VBA and Custom Forms 3
V Emails going into Drafts instead of Sent folder Using Outlook 3
V Items missing in Sent folder Using Outlook 10
P Outlook 2016 Client and 365 - Groups Folder Using Outlook 3
Similar threads


















































Top