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. _
            OlItemType.olContactItem)
        Try
            With newContact
                .FirstName = "Jo"
                .LastName = "Berry"
                .Email1Address = "somebody@example.com"
                .CustomerID = "123456"
                .PrimaryTelephoneNumber = "(425)555-0111"
                .MailingAddressStreet = "123 Main St."
                .MailingAddressCity = "Redmond"
                .MailingAddressState = "WA"
                .Save()
                .Display(True)
            End With
        Catch
            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

Show: