• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 575
  • Last Modified:

Integer data type missing on VSTO for Outlook 2003

We use custom fields in Outlook (user properties)
One of these is called ScanID which is Integer data type.
We use both Outlook 2003 and Outlook 2007.
For the Outlook 2007 VSTO project, the below line works fine

Mail1.UserProperties.Add("ScanID", Outlook.OlUserPropertyType.olInteger)

ForOutlook 2003, the interop assembly doesn't seem to have olInteger property. I can use olNumber as data type but then that causes an error such as:
"A custom field with this name but a different data type already exists. Enter a different name."

I know Outlook 2003 supports this data type because I can add a new field using Outlook's GUI and specify Integer. Why doesn't it recognise it in VSTO?
1 Solution
Miguel OzSoftware EngineerCommented:
The  OlUserPropertyType enumerator is defined at Microsoft.Office.Interop.Outlook (in microsoft.office.interop.outlook.dll)
Version 11 does not contain this enumerator value but version 12 does, it is a limitation of the assembly itself. Unfortuantely this feature has not been surfaced for Interop in Outlook 2003.
Billy_LondonAuthor Commented:
i'll have to work around this with some error-checking instead. When it throws up the error after trying to create olNumber user property type, it still creates the user property, but sets it to zero.
Microsoft won't help on this unless I pay them because it's not supported any more so s*d them!

i'll use something like below

            On Error Resume Next
            Mail1.UserProperties.Add("ScanID", Outlook.OlUserPropertyType.olNumber)
            On Error GoTo ErrorTrap
            Mail1.UserProperties("ScanID").Value = 12345
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now