User-Defined Fields in Folder

E

envywaits

Looking for suggestions on how to programmatically access (VBA) the
user-defined fields on the -folder- level of an Outlook Contact. I've
tried using "UserProperty" but I cannot get it to return any results
even though I've checked and double-checked that I'm using it properly.
It appears to only return results for user-defined fields on the
-item- not the -folder-, which is what I need.

Much appreciated!

--Patrick
 
S

Sue Mosher [MVP-Outlook]

E

envywaits

I'm trying to programmatically export outlook contacts to an MS-Access
database. I've run into two issues:

1. The program halts when a distribution list is encountered.
2. There is a user-defined field in the Outlook Folder that I cannot
seem to programmatically identify for export.

I've tried using If/Then statements to weed out the distribution lists,
but have not met with any success. When running the routine on contact
lists without distribution lists, it runs perfectly well.

Thank you!!
 
S

Sue Mosher [MVP-Outlook]

1) Your code should handle this either with an On Error Resume Next statement to ignore the error or by checking the Class property of each item to see if it is a ContactItem before invoking any contact-specific properties.

2) In the context of an export, what fields are defined at the folder level is irrelevant. All the custom fields available for export will be in each item's UserProperties collection, because it is ***in the item*** that the data resides.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
B

Brian Tillman

I'm trying to programmatically export outlook contacts to an MS-Access
database. I've run into two issues:

As Sue already said, your best bet is to take it up in the programming
newsgroup.
 
K

Karl Timmermans

Re: Distribution List issue - Simple solution to #1 is to filter your
contact items to "exclude" IPM.DistList message class items or alternatively
just "include" the specific message class(es) you want to process.

Re: Form level user-defined fields versus User-Property collection

User-property collection may contain all the user-defined fields BUT it will
also contain USELESS field info if there has been any kind of editing done
where fields have been added/deleted etc which must be handled if just
trying to traverse the user-property collection. Not quite as simple and
straight-forward as olContact.UserProperties("FieldName") which will return
the correct entry. Unfortunately, that approach only works if you happen to
know all the field names up front when writing the code. Otherwise one has
to hope that Outlook hasn't introduced one of its many "undocumented
features".

There are a whole myriad of scenarios/caveats for both the folder level &
item level property collections and Outlook can make problematic situations
<very easy> to occur. Can't depend on either collection to be "accurate" for
a specific outcome without somehow knowing (guessing or otherwise stating)
what is and isn't relevant (not to mention having to dynamically alter the
<output> file to keep adding new fields if the plan is to simply go through
each contact one at a time).

However, as Brian correctly stated - this is really an issue related to the
programming group.

Karl
_____________________________________________________________
ContactGenie - Importer 1.3 / DataPorter 2.0 / Exporter
"Power contact importers/exporters for MS Outlook '2000/2003"
http://www.contactgenie.com



1) Your code should handle this either with an On Error Resume Next
statement to ignore the error or by checking the Class property of each item
to see if it is a ContactItem before invoking any contact-specific
properties.

2) In the context of an export, what fields are defined at the folder level
is irrelevant. All the custom fields available for export will be in each
item's UserProperties collection, because it is ***in the item*** that the
data resides.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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