Folder.CopyTo Method

Outlook Developer Reference

Copies the current folder in its entirety to the destination folder.

Version Information
 Version Added:  Outlook 2007

Syntax

expression.CopyTo(DestinationFolder)

expression   A variable that represents a Folder object.

Parameters

Name Required/Optional Data Type Description
DestinationFolder Required Folder Required Folder object that represents the destination folder.

Return Value
A Folder object that represents the new copy of the current folder.

Example

This Visual Basic for Applications (VBA) example uses the CopyTo method to copy the default Contacts folder to the default Inbox folder.

Visual Basic for Applications
  Sub CopyFolder()
    Dim myNameSpace As Outlook.NameSpace
    Dim myInboxFolder As Outlook.Folder
    Dim myContactsFolder As Outlook.Folder
    Dim myNewFolder As Outlook.Folder
Set myNameSpace = Application.GetNamespace("MAPI")
Set myInboxFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myContactsFolder = myNameSpace.GetDefaultFolder(olFolderContacts)
Set myNewFolder = myContactsFolder.<strong>CopyTo</strong>(myInboxFolder)

End Sub

See Also