A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Referencing User-Defined Fields



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 13th 06, 02:50 PM posted to microsoft.public.outlook.program_vba
Chaplain Doug
external usenet poster
 
Posts: 38
Default Referencing User-Defined Fields

Outlook 2003. I have created a custom contact form and added two
"user-defined" fields called "Employment Date" and "Spouse Birthday." How
may I programmatically reference these fields in a contact? For instance, in
the following code, how would I reference the fields?

Dim olApp As New Outlook.Application
Dim olNS As Outlook.Namespace
Dim ctFolder As Outlook.MAPIFolder
Dim ctFolderItems As Outlook.Items
Dim iterateCtItems As Integer
Dim countCtItems As Integer
Dim IC As Integer
Dim Criteria As String
Dim itm As Object

On Error Resume Next
Set olNS = olApp.GetNamespace("MAPI")
Set ctFolder = olNS.Folders("Public Folders")
Set ctFolder = ctFolder.Folders("All Public Folders")
Set ctFolder = ctFolder.Folders("Good News Contacts")
Set ctFolderItems = ctFolder.Items
countCtItems = ctFolderItems.Count
'************************************************* *******
For Each itm In ctFolderItems
Debug.Print itm.FullName 'No problem for a standard contact field
Debug.Print itm.????????? 'What do I put for a user-defined
field?
Next
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org
Ads
  #2  
Old January 13th 06, 06:47 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Referencing User-Defined Fields

Use the UserProperties collection and UserProperty objects:

Dim objUPS As UserProperties
Dim objUP As UserProperty

Set objUPS = itm.UserProperties
Set objUP = objUPS.Item("MyCustomFieldName")
objUP.Value = "My test value"

--
Eric Legault (Outlook MVP, MCDBA, old school WOSA MCSD, B.A.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Chaplain Doug" wrote:

Outlook 2003. I have created a custom contact form and added two
"user-defined" fields called "Employment Date" and "Spouse Birthday." How
may I programmatically reference these fields in a contact? For instance, in
the following code, how would I reference the fields?

Dim olApp As New Outlook.Application
Dim olNS As Outlook.Namespace
Dim ctFolder As Outlook.MAPIFolder
Dim ctFolderItems As Outlook.Items
Dim iterateCtItems As Integer
Dim countCtItems As Integer
Dim IC As Integer
Dim Criteria As String
Dim itm As Object

On Error Resume Next
Set olNS = olApp.GetNamespace("MAPI")
Set ctFolder = olNS.Folders("Public Folders")
Set ctFolder = ctFolder.Folders("All Public Folders")
Set ctFolder = ctFolder.Folders("Good News Contacts")
Set ctFolderItems = ctFolder.Items
countCtItems = ctFolderItems.Count
'************************************************* *******
For Each itm In ctFolderItems
Debug.Print itm.FullName 'No problem for a standard contact field
Debug.Print itm.????????? 'What do I put for a user-defined
field?
Next
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org

  #3  
Old January 13th 06, 06:54 PM posted to microsoft.public.outlook.program_vba
Chaplain Doug
external usenet poster
 
Posts: 38
Default Referencing User-Defined Fields

Thank you Eric.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org


"Eric Legault [MVP - Outlook]" wrote:

Use the UserProperties collection and UserProperty objects:

Dim objUPS As UserProperties
Dim objUP As UserProperty

Set objUPS = itm.UserProperties
Set objUP = objUPS.Item("MyCustomFieldName")
objUP.Value = "My test value"

--
Eric Legault (Outlook MVP, MCDBA, old school WOSA MCSD, B.A.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Chaplain Doug" wrote:

Outlook 2003. I have created a custom contact form and added two
"user-defined" fields called "Employment Date" and "Spouse Birthday." How
may I programmatically reference these fields in a contact? For instance, in
the following code, how would I reference the fields?

Dim olApp As New Outlook.Application
Dim olNS As Outlook.Namespace
Dim ctFolder As Outlook.MAPIFolder
Dim ctFolderItems As Outlook.Items
Dim iterateCtItems As Integer
Dim countCtItems As Integer
Dim IC As Integer
Dim Criteria As String
Dim itm As Object

On Error Resume Next
Set olNS = olApp.GetNamespace("MAPI")
Set ctFolder = olNS.Folders("Public Folders")
Set ctFolder = ctFolder.Folders("All Public Folders")
Set ctFolder = ctFolder.Folders("Good News Contacts")
Set ctFolderItems = ctFolder.Items
countCtItems = ctFolderItems.Count
'************************************************* *******
For Each itm In ctFolderItems
Debug.Print itm.FullName 'No problem for a standard contact field
Debug.Print itm.????????? 'What do I put for a user-defined
field?
Next
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing order of user defined fields Amy Outlook - Using Forms 2 March 2nd 06 05:53 PM
Export & Import of outlook 2003 "User Defined Fields" at folder le Kamele0n Outlook - Using Contacts 1 February 25th 06 05:34 PM
user defined fields Karl-H. Engesser Outlook - Using Contacts 1 February 9th 06 03:33 PM
How do I rename user defined field names? Sue Mosher [MVP-Outlook] Outlook - Using Contacts 1 January 19th 06 04:13 AM
Referencing a User-Defined Field Chaplain Doug Outlook - Using Forms 1 January 13th 06 04:54 PM


All times are GMT +1. The time now is 08:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.