This quick snip should do the trick but there are lots of ways to do the
same thing. To stress, this should only be used for UDF's that are
NOT part of a custom form definition.
--------------------------------------Dim olItms As Outlook.Items
Dim olCItm As Outlook.ContactItem
Dim olUProp As Outlook.UserProperty
' assume olItms already set to selected ContactFolder.Items
For Each olCItm In olItms
'this skips everything other than contacts assigned to the
'standard contact message class
If olCItm.MessageClass <> "IPM.Contact" Then
GoTo Next_Con
End If
Set olUProp = olCItm.UserProperties.Find("PropName", True)
'this will skip the property if it doesn't exist for a given
contact
'UDF's should NEVER be deleted this way if a custom form
' is in use
If olUProp Is Nothing Then
'if checking for more than one UDF - adjust accordingly
GoTo Next_Con
End If
olUProp.Delete
olCItm.Save
Next_Con:
Next
---------------------------------------Karl
______________________
ContactGenie - QuickPort/DataPort/Exporter/Toolkit/Duplicate Contact Mgr
"""
"JoeRob" <JoeRob> wrote in message
news:0C78736E-997F-4F3F-BB53-91439DC0D953@microsoft.com...
> Karl,
> What would the code to remove userdifined fields look like. Would this
> be
> something using "userproperties.remove" and what would the expressions
> after
> setting the object to a folder look like?
> "Karl Timmermans" wrote:
>
> > Just to add to Sue's response:
>
>> #1 - If UDF's are exclusively part of the custom form
> > then you only need to remove them from the form definition
> > (unless the same fields were created in the folder prior to
> > the custom form being assigned)
>
>> #2 - If no custom form in play, removing the fields from the
> > "In folder" group will not remove the fields already assigned
> > to an individual item which occurs if there is a value in a
> > given UDF field. In those cases, if you want to completely
> > remove all traces of the UDF, you will need to remove
> > each UDF from each individual contact item where these
> > occur. (something that can be very easily done in bulk
> > via VBA)
>
>> Karl
>
>> > > ______________________
> >
> > ContactGenie - QuickPort/DataPort/Exporter/Toolkit/Duplicate Contact Mgr
> > """
> >
>
>
>> "JoeRob" <JoeRob> wrote in message
> > news:BCB9FACA-F885-4AD5-B38A-EF196556E12A@microsoft.com...
> > > In "hacking about", I created several user defined fields which I
> > > would
> > > like
> > > to remove. Under "all fields" they are listed under "User-Defined
> > > Field
> > > In
> > > This Item", "User-Defined Fields In This Folder"and "Mens
> > > Club"(custome
> > > form). How can I remove these fields.
>
>
>> .
> >