Programmatically accessing Outlook properties


Krutika Suchak


Programmatically we are accessing outlook contact property and synchronizing
the outlook contact with MS CRM 4.0.
Till now we were using each property individually to get/set the properties
and we were syncing very few fields to CRM so it was manageble but now we
need to sync the fields on demand to CRM so in this case specifiing each
property in the code and handling them indicidually is pain. We need to make
it dynamically. So what we thought is we will maintain a xml file in the
solution and will add the node with property name and datatype but the
question here is which name to refer and how to get/ set properties just with
the property name? As far as I know we can set/ get properties by using
Tags.(intelisense-propertyname). Dont know how to proceed with this? Thanks
for any kind of help.


Ken Slovak - [MVP - Outlook]

The Outlook property names you would need to use and their data types are
all listed in the Object Browser. Just use that on whatever objects such as
ContactItem you want.

You can use string values representing property names with the
ItemProperties collection of a ContactItem.

For example:

sPropName = "Subject"
sPropValue = oContact.ItemProperties.Item(sPropName)

An ItemProperty object has a Type property that returns a member of the
OlUserProeprtyType enum that will tell you the data type for the property.

Krutika Suchak

Thanks for the reply but the question here is we do not want to hard code the
attribute name we just want to take is dynamically from some XML file.

We are thinking of maintaining a XML file whose structure can be like:
<Attribute name=â€Client†DataType=â€Boolean†/>
<Attribute name=â€ManagerPhone†DataType=â€String†/>
so we can fetch attribute name from this file and can use what you have

For this, where will we get the name of all PR_ tags for the Outlook fields.

Ken Slovak - [MVP - Outlook]

First you have to decide what you want.

Do you want Outlook property names or do you want MAPI tags in PR format?

MAPI tags are listed in various MAPI header files that are part of Windows
SDK among other downloads. You can also use a MAPI viewer such as MFCMAPI or
OutlookSpy to get PR type tags for properties or get DASL type property

Outlook object model property names you can get from the Object Browser or
run prototype code iterating the ItemProperties collection of an item.

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