How to: Programmatically Add an Entry to Outlook Contacts


This example creates a new contact and enters data into the new contact.

Applies to: The information in this topic applies to VSTO add-in projects for Outlook. For more information, see Features Available by Office Application and Project Type.

    Private Sub AddContact()
        Dim newContact As Outlook.ContactItem = Me.Application.CreateItem(Outlook. _
            With newContact
                .FirstName = "Jo"
                .LastName = "Berry"
                .Email1Address = ""
                .CustomerID = "123456"
                .PrimaryTelephoneNumber = "(425)555-0111"
                .MailingAddressStreet = "123 Main St."
                .MailingAddressCity = "Redmond"
                .MailingAddressState = "WA"
            End With
            MsgBox("The new contact was not saved.")
        End Try
    End Sub

Working with Contact Items
How to: Programmatically Create Appointments
How to: Programmatically Access Outlook Contacts
How to: Programmatically Search for an E-Mail Address in Contacts