Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Add-ins for Outlook (http://www.outlookbanter.com/add-ins-outlook/)
-   -   Outlook add-in: How to find localized name of the "Junk e-mail"folder (http://www.outlookbanter.com/add-ins-outlook/90275-outlook-add-how-find-localized.html)

Ken Slovak - [MVP - Outlook] May 26th 09 04:35 PM

Outlook add-in: How to find localized name of the "Junk e-mail" folder
 
You can locate the junk folders for any store, but how they work is just as
normal folders in Outlook unless it's the junk folder for the default store.
That's the only one that will do the junk mail processing as items come in.
If you open a PST file as a secondary store that junk folder won't be
active.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


wrote in message
...
Will it be possible to call

Store.GetSpecialFolder(olFolderJunk) to retrieve a junk folder for
every store instead of retrieving the generic one via
Session.GetDefaultFolder(olFolderJunk) ? And in a similar way marking
stuff as not spam would then move the item to Store.GetSpecialFolder
(olFolderInbox)

Does it make any sense?



[email protected] June 2nd 09 03:43 PM

Outlook add-in: How to find localized name of the "Junk e-mail"folder
 
OK I think I confused things a little bit. Now I am sure that I
finally found what I wanted to ask:

I found out that a store's Junk email can be identified as a 5th
element of the PR_ADDITIONAL_REN_ENTRYIDS IMAPIFolder property
Given a MailItem or a Folder instance how do I get that info? I assume
that I need to do something like this:

IUnknown *u;
folder-get_MAPIOBJECT(&u);
// will this give me the IMAPIFolder interface?
// How do I get the PR_ADDITIONAL_REN_ENTRYIDS property?
// How do I get the 5th element out of it?
// once I have it I can then do something like
namespace-GetFolderFromEntryID(entryID_received_from_steps_ above);

Could you please shed some light on this? I did not find any source
code that does this. C# or C++ does not matter just as long as there
is something.

Many thanks

Ken Slovak - [MVP - Outlook] June 2nd 09 04:04 PM

Outlook add-in: How to find localized name of the "Junk e-mail" folder
 
I' not sure that's immutable and not dependent on the store provider, but
you get that PT_MV_BINARY property from the Inbox folder of a store using
the property tag 0x36D81102. Once you have that property it's just a array
of binary properties. So you get the 5th element of the array and then
convert that binary property into a hex string if you want.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


wrote in message
...
OK I think I confused things a little bit. Now I am sure that I
finally found what I wanted to ask:

I found out that a store's Junk email can be identified as a 5th
element of the PR_ADDITIONAL_REN_ENTRYIDS IMAPIFolder property
Given a MailItem or a Folder instance how do I get that info? I assume
that I need to do something like this:

IUnknown *u;
folder-get_MAPIOBJECT(&u);
// will this give me the IMAPIFolder interface?
// How do I get the PR_ADDITIONAL_REN_ENTRYIDS property?
// How do I get the 5th element out of it?
// once I have it I can then do something like
namespace-GetFolderFromEntryID(entryID_received_from_steps_ above);

Could you please shed some light on this? I did not find any source
code that does this. C# or C++ does not matter just as long as there
is something.

Many thanks



[email protected] June 2nd 09 04:42 PM

Outlook add-in: How to find localized name of the "Junk e-mail"folder
 
I' not sure that's immutable and not dependent on the store provider, but
you get that PT_MV_BINARY property from the Inbox folder of a store using
the property tag 0x36D81102.


Can I find a source code anywhere that would show in detail how to do
this?
I don't know how to use property tag 0x36D81102 (I assume I do it
wrong)

void myfunction(CComPtr Outlook::_MailItem mi)
{
CComPtr IDispatch disp;
CComPtr MAPIFolder folder;
CComPtr IUnknown unk;
CComPtr IMAPIFolder ifolder;
SPropTagArray tags = {1, 0x36D81102/*PR_ADDITIONAL_REN_ENTRYIDS*/};
ULONG flags = 0, values;
LPSPropValue props;

mi-get_Parent(&disp);
disp-QueryInterface(__uuidof(MAPIFolder), (void **)&folder);
folder-get_MAPIOBJECT(&unk);
unk-QueryInterface(IID_IMAPIFolder, (void**)&ifolder);
ifolder-GetProps(&tags, flags, &values, &props);
...
at this point I think props should be filled with meaningfull data.
Debugger shows that props[0].Value.bin.cb == 6 but here the field props
[0].Value.bin.lb does not show anything similar to what OutlookSpy
shows :-(

[email protected] June 2nd 09 04:46 PM

Outlook add-in: How to find localized name of the "Junk e-mail"folder
 
Can I find a source code somewhere that shows how exatly do I get the
property with tag 0x36D81102 ???
I am probably doing something wrong. Here is what I do:

void myFunction(CComPtr Outlook::_MailItem mi)
{
CComPtr IDispatch disp;
CComPtr MAPIFolder folder;
CComPtr IUnknown unk;
CComPtr IMAPIFolder ifolder;
SPropTagArray tags = {1, 0x36D81102/*PR_ADDITIONAL_REN_ENTRYIDS*/};
ULONG flags = 0, values;
LPSPropValue props;

mi-get_Parent(&disp);
disp-QueryInterface(__uuidof(MAPIFolder), (void **)&folder);
folder-get_MAPIOBJECT(&unk);
unk-QueryInterface(IID_IMAPIFolder, (void**)&ifolder);
ifolder-GetProps(&tags, flags, &values, &props);
....
at this point props[0].Value.bin.cb == 6 according to the debugger but
props[0].Value.bin.lpb does not show anything similar to what
OutlookSpy reports :-(

Ken Slovak - [MVP - Outlook] June 2nd 09 07:00 PM

Outlook add-in: How to find localized name of the "Junk e-mail" folder
 
Unless Dmitry answers this you should post Extended MAPI questions in
microsoft.public.win32.programmer.messaging, where the MAPI people hang out.

Most of the examples for things like this I know of are for the Outlook or
Redemption object models.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


wrote in message
...
I' not sure that's immutable and not dependent on the store provider, but
you get that PT_MV_BINARY property from the Inbox folder of a store using
the property tag 0x36D81102.


Can I find a source code anywhere that would show in detail how to do
this?
I don't know how to use property tag 0x36D81102 (I assume I do it
wrong)

void myfunction(CComPtr Outlook::_MailItem mi)
{
CComPtr IDispatch disp;
CComPtr MAPIFolder folder;
CComPtr IUnknown unk;
CComPtr IMAPIFolder ifolder;
SPropTagArray tags = {1, 0x36D81102/*PR_ADDITIONAL_REN_ENTRYIDS*/};
ULONG flags = 0, values;
LPSPropValue props;

mi-get_Parent(&disp);
disp-QueryInterface(__uuidof(MAPIFolder), (void **)&folder);
folder-get_MAPIOBJECT(&unk);
unk-QueryInterface(IID_IMAPIFolder, (void**)&ifolder);
ifolder-GetProps(&tags, flags, &values, &props);
...
at this point I think props should be filled with meaningfull data.
Debugger shows that props[0].Value.bin.cb == 6 but here the field props
[0].Value.bin.lb does not show anything similar to what OutlookSpy
shows :-(




All times are GMT +1. The time now is 11:16 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com