Retrieving the DisplayFormat for a UserProperty using VB

  • Thread starter Thread starter leslie.mcgann
  • Start date Start date
L

leslie.mcgann

Hello,

I'm trying to write some VB code that pulls all of the control and
field information out of an .oft file. The issue I'm having is that I
would like to get at the DisplayFormat property of a field
(UserProperty) that belongs to the item represented by the .oft (i.e.,
MailItem, PostItem).

The .oft was created by someone at a different organization, so when
my code calls CreateItemFromTemplate, I am unable to create the item
in the folder where the UserDefinedProperties (folder fields) context
would be available. I noticed that you can access the DisplayFormat
via the UserDefinedProperty interface for a field that has been added
to a folder, *BUT* it does not appear to be possible to get the
DisplayFormat for a field (UserProperty) that only has the context of
the item.

I did a test where I created a field in the Outlook 2007 form
designer, chose a type of numeric and a display format, and bound it
to a control on a form. Then I deleted the field from the folder
fields so that it was only stored in the item. I ran the form and the
display format was still applied, even though the field now only
resides within the item. So, it seems that the DisplayFormat info
must still be stored somewhere at the item level, even though the
field has been deleted from the folder level (UserDefinedProperties).
The question is, is there a way to access the DisplayFormat info for
an item field (UserProperty) programmatically?

Thanks,
Leslie McGann-Sturgeon
 
Have you tried publishing that form to an appropriate folder and seeing if
the properties you want are there?
 
Hi Ken,

Thanks for your response. I just tried publishing a test .oft file to
a folder, and none of the fields from the oft appeared at the folder
level after publishing. I'm new to Outlook, so I'm not sure what you
mean by publishing it to an "appropriate" folder. Also, if I were to
receive a batch of several hundred .oft files created at another
organization, how would I know what "appropriate" folder to publish
them to? Could each one have a different "appropriate" folder?

At any rate, I would like to be able to get all of the information out
of the .oft files programmatically, without having to perform any
manual steps using the Outlook UI. It is too bad that there doesn't
seem to be any way to get at several pieces of information associated
with fields contained in an .oft file by using the API:

- DisplayFormat
- Whether the field is required to be filled in
- Whether the field should be included for printing

If you know of any way that I can get this info programmatically, I
would be grateful if you could let me know.
 
You at minimum have to create an item from an OFT to access it and any
available properties. An appropriate folder is one that holds that type of
item, i.e a Contacts folder for contact items, Mail folder for email items,
Tasks folder for task items, etc.

Other than what you've tried and UserProperties in an item and any
FormDescription properties for it there is no other way to access the
properties of the item in the Outlook object model. You can get additional
information using a lower level API such as Extended MAPI (C++ or Delphi
only), or you can examine an item using a MAPI viewer such as MFCMAPI from
MS or OutlookSpy (www.dimastr.com), but in many cases any such additional
information is in undocumented binary properties so won't make much sense.

If you are actually hiring people to create custom forms for you they should
be supplying documentation and/or publishing the forms to a folder in a PST
file so you have access to any folder as well as item properties.

If you create an item from an OFT you can examine the properties of every
control on the item to see what validations, etc. are applied.




Hi Ken,

Thanks for your response. I just tried publishing a test .oft file to
a folder, and none of the fields from the oft appeared at the folder
level after publishing. I'm new to Outlook, so I'm not sure what you
mean by publishing it to an "appropriate" folder. Also, if I were to
receive a batch of several hundred .oft files created at another
organization, how would I know what "appropriate" folder to publish
them to? Could each one have a different "appropriate" folder?

At any rate, I would like to be able to get all of the information out
of the .oft files programmatically, without having to perform any
manual steps using the Outlook UI. It is too bad that there doesn't
seem to be any way to get at several pieces of information associated
with fields contained in an .oft file by using the API:

- DisplayFormat
- Whether the field is required to be filled in
- Whether the field should be included for printing

If you know of any way that I can get this info programmatically, I
would be grateful if you could let me know.
 
Back
Top