Custom fields

  • Thread starter Thread starter Gordon MacLeod
  • Start date Start date
G

Gordon MacLeod

Hi:

I have read some of the examples on the site
http://www.microeye.com/resources/res_tech_vsnet.htm
None of them address custom fields.

I added two new fields to Outlook (in Outlook), and entered info for a
couple of contacts, but when I run my .net app that reads contacts, the two
new fields do not show up in the intellisense for the contactitem object.

Any ideas?

Gordon M.
 
I took your suggestion, but I get an error. Thanks for responding to my
query by the way. I have looked into getting your book, but will have to
order it, I can't find it anywhere.
' Create Outlook application.

Dim oApp As Outlook.Application = New Outlook.Application

' Get NameSpace and Logon.

Dim oNS As Outlook.NameSpace = oApp.GetNamespace("mapi")

oNS.Logon("Outlook", Missing.Value, False, True) ' TODO:

' Get the first contact from the Contacts folder.

Dim cContacts As Outlook.MAPIFolder =
oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)

Dim oItems As Outlook.Items = cContacts.Items

Dim oCt As Outlook.ContactItem

Try

oCt = oItems.GetFirst()



' Display some common properties.

Console.WriteLine(oCt.FullName)

Console.WriteLine(oCt.UserProperties("Doctor")) THIS IS THE LINE WHERE
USERPROPERTIES GETS SQUIGLED.

'Console.WriteLine(oCt.ShoeSize)

as you suggested, but I get that squiggly line under UserProperties, the
Task list shows:



C:\_BioPed\Read Contacts\Module1.vb(34): Interface 'Outlook.UserProperties'
cannot be indexed because it has no default property.




Help!



Intellisense shows only those properties in the object model, not custom
properties, which you access through the ItemProperties or UserProperties
collection. See http://www.outlookcode.com/d/propsyntax.htm

FYI, there is a newsgroup specifically for general Outlook programming
issues "down the hall" at microsoft.public.outlook.program_vba or, via web
interface, at
http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.pu
blic.outlook.program_vba
 
Try the full syntax: oCt.UserProperties.Find("Doctor")

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top