Custom fields

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.
 
S

Sue Mosher [MVP-Outlook]

G

Gordon MacLeod

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
 
S

Sue Mosher [MVP-Outlook]

Try the full syntax: oCt.UserProperties.Find("Doctor")

--
Sue Mosher, Outlook MVP
Author of
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