Programmatically accessing Outlook properties

  • Thread starter Thread starter Krutika Suchak
  • Start date Start date
K

Krutika Suchak

Hi,

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.

Thanks,
Krutika
 
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.
 
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:
<outlookattributes>
<Attribute name=â€Client†DataType=â€Boolean†/>
<Attribute name=â€ManagerPhone†DataType=â€String†/>
......
</outlookattributes>
so we can fetch attribute name from this file and can use what you have
suggested.

For this, where will we get the name of all PR_ tags for the Outlook fields.
 
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
tags.

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