OOM properties mapped to MAPI properties?

E

Eric

Does anyone know of a list of how Outlook Object Model (OOM) OLE
properties map to MAPI properties.

For example, in OOM I would use:

ContactItem.BusinessAddressStreet = "123 W Main St."

In MAPI I would think this might be:

PR_STREET_ADDRESS = "123 W Main St."

However, this isn't correct. In fact, when I set PR_STREET_ADDRESS
alone, I don't even see the new value I set anywhere (unless I use
Outlook Spy to view PR_STREET_ADDRESS directly).

When I set "ContactItem.BusinessAddressStreet" using the OOM, or if I
edit the Business Street Address manually in Outlook, I notice at
least 2 or 3 MAPI properties are changed. I could just set all of
them in my code, but my overall goal is to keep these fields
synchronized with another database, which is very complex if I have to
synchronize 1 field in my database to 10 fields in Outlook (what if on
the next sync all 10 fields in Outlook have different values, which
one would I use then?).
 
D

Dmitry Streblechenko \(MVP\)

For the contacts, most OOM properties are stored as named properties (bolded
when displayed by OutlookSpy, which also displays OOM names for the named
IMessage properties when there is a 1-to-1 match between the two)

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
E

Eric

Thank you for the responses. I'll have to get that update to Outlook
Spy to see those OOM names, that should be usefull, as well as the
list on cdolive.

When I do set a property, like CdoContact_BusinessAddressStreet, the
dificult thing about MAPI which I didn't have to worry about with OOM
is that it doesn't update CdoContact_BusinessAddress for me. Which
does give the MAPI user more power, since I can format
CdoContact_BusinessAddress however I want, but in this case I'd rather
just have Outlook auto-format it for me. MAPI doesn't update the
CdoPR_POSTAL_ADDRESS field either, which OOM does if the checkbox is
set to make the business address the mailing address. With MAPI I
would have to check the value of that property and apply all these
rules myself, which whenever some version of Outlook changes the
rules, my app would need to be updated.

I wish Microsoft would document this stuff, or better yet, give us an
easier way to work with this data which doesn't have the "security
prompts". If you read the MSDN/KB articles about the security prompts
which occur when using OOM/CDO, Microsoft recommends we (the 3rd party
developers) should update to using Extended MAPI. So it isn't like
I'm doing anything unique or "unsupported" here.

I guess I'll have to mix MAPI with OOM maybe, but I'm guessing the all
MAPI route would have been faster.
 
D

Dmitry Streblechenko \(MVP\)

Note that setting properties blocked by the secury patch does *not* raise
any prompts, only reading is blocked. And for reading you can use Extended
MAPI. You don't have to use either OOM or MAPI, you can read using MAPI and
write using OOM.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
E

Eric

I hadn't thought about that, sounds like a good combination. I think
I'll still do the initial creation via MAPI, since using OOM requires
saving the item and then moving it to the correct folder if you don't
want it in the default folder.

At any rate, I'm using MAPI on a 2nd thread currently, mostly because
it made handling of my progress display easier. I've read it isn't
safe to use the Application object, the one passed by Outlook when my
add-in is loaded, on another thread. Is this true? I'm just going to
use it for setting properties, and not for notifications/callbacks, so
maybe it is safe in this case, or still not? If not safe, what would
you recommend for getting a new object which would work on this other
thread? GetActiveObject()?
 
D

Dmitry Streblechenko \(MVP\)

You can use Application in a thread other than the main thread, but the
object is apartment-threaded, so you will end up switching to the main
thread when calling Application properties and methods.

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