Creating a Contact in the Exchange Store
The document is archived and information here might be outdated

Creating a Contact in the Exchange Store

Exchange Server 2003

Creating a Contact in the Exchange Store

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Creating a contact involves setting informational properties and saving the contact to the Exchange store.


The following example creates a contact using the Collaboration Data Objects (CDO) Person object and saves it to the Exchange store.

Visual Basic

Note  This example uses a file URL with the Exchange OLE DB (ExOLEDB) provider. The ExOLEDB provider also supports The HTTP: URL Scheme. Using The HTTP: URL Scheme allows both client and server applications to use a single URL scheme.
Sub CreateContactWebStore()

Dim oPerson As New CDO.Person
Dim strURL As String

oPerson.FirstName = "John"
oPerson.LastName = "Smith"
oPerson.HomeCity = "Redmond"
oPerson.HomeState = "Washington"
oPerson.Email = ""
oPerson.Fields("objectClass").Value = "contact"

'URL to save the contact using Exchange OLE DB Provider
strURL = "file://./backofficestorage/"

'Save the contact to Exchange store
oPerson.DataSource.SaveTo strURL

End Sub

By default, the CDO person object creates a user. In the preceding code, the oPerson.Fields("objectClass").Value is set to type "contact" to create a contact.

The objectClass value is an array of variants, however the property can accept a single value. The value might be one of the following:

  oPerson.Fields("objectClass").Value = "contact"
  oPerson.Fields("objectClass").Value = Array("top", "person", _ "organizationalPerson", "contact")
© 2016 Microsoft