How to: Copy Items in Outlook

This example creates a copy of a mail item and displays it to the user.

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

Example

Private Sub ThisAddIn_Startup(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Startup
    Dim mail As Outlook.MailItem = _
        TryCast(Me.Application.GetNamespace("MAPI"). _
        GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox). _
        Items.GetFirst(), Outlook.MailItem)

    If mail IsNot Nothing Then

        ' Create a copy of the item.
        Dim copyMail As Outlook.MailItem = _
            TryCast(mail.Copy(), Outlook.MailItem)

        ' Show the copy to the user.
        copyMail.Display(True)
    End If
End Sub

See Also

Tasks

How to: Move Items in Outlook

How to: Create Custom Folder Items

How to: Retrieve a Folder by Name

Concepts

Working with Folders