The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

How to: Send a Mail Item with an Electronic Business Card

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This example creates a mail item, looks for an Electronic Business Card, and if it finds one, inserts the Electronic Business Card into the mail item.

To insert an Electronic Business Card, you can call AddBusinessCard on the MailItem object. This method takes a string representing an e-mail address and attempts to find a ContactItem with that address in the default Contacts folder. A ContactItem can have as many as three e-mail addresses. If the contact is found, the example calls the AddBusinessCard method, and then displays the message to the user.

If you use Microsoft Visual Studio to test this code sample, you must first add a reference to the Microsoft Outlook 12.0 Object Library component and specify the Outlook variable when you import the Microsoft.Office.Interop.Outlook namespace. The Imports or using statements must not occur right before the functions in the Code section but must be added before the public Class declaration. The following lines of code show how to do the import and assignment in Visual Basic and in C#:

using Outlook = Microsoft.Office.Interop.Outlook;
private void AddBusinessCard(string eMailAddress)
    Outlook.MailItem mail = Application.CreateItem(
        Outlook.OlItemType.olMailItem) as Outlook.MailItem;
    mail.BodyFormat = Outlook.OlBodyFormat.olFormatHTML;
    Outlook.ContactItem contact = Application.Session.
        "[Email1Address]='" + eMailAddress + "'" + " OR " +
        "[Email2Address]='" + eMailAddress + "'" + " OR " +
        "[Email3Address]='" + eMailAddress + "'")
        as Outlook.ContactItem;
    if (contact == null)