Partager via


Folder Interface

Represents an Outlook folder.

Namespace:  Microsoft.Office.Interop.Outlook
Assembly:  Microsoft.Office.Interop.Outlook (in Microsoft.Office.Interop.Outlook.dll)

Syntax

'Declaration
<CoClassAttribute(GetType(FolderClass))> _
<GuidAttribute("00063006-0000-0000-C000-000000000046")> _
Public Interface Folder _
    Inherits MAPIFolder, MAPIFolderEvents_12_Event
'Usage
Dim instance As Folder
[CoClassAttribute(typeof(FolderClass))]
[GuidAttribute("00063006-0000-0000-C000-000000000046")]
public interface Folder : MAPIFolder, MAPIFolderEvents_12_Event

Remarks

This is a .NET interface derived from a COM coclass that is required by managed code for interoperability with the corresponding COM object. Use this interface to access all method, property, and event members of the COM object Folder. Refer to this topic for information about the COM object. For information about the method and property members of the COM object, see MAPIFolder. For information about the event members of the COM object, see MAPIFolderEvents_12_Event.

A Folder object can contain other Folder objects, as well as Outlook items. Use the Folders property of a NameSpace object or another Folder object to return the set of folders in a NameSpace or under a folder. You can navigate nested folders by starting from a top-level folder, say the Inbox, and using a combination of the MAPIFolder.Folders property, which returns the set of folders underneath a Folder object in the hierarchy, and the _Folders.Item property (this in C#), which returns a folder within the Folders collection.

There is a set of folders within an Outlook data store that supports the default functionality of Outlook. Use _NameSpace.GetDefaultFolder, specifying an index that is one of the constants in the OlDefaultFolders enumeration to return one of the default Outlook folders in the Outlook NameSpace object.

While generally it is a good practice to place items that serve the same functionality in the same folder, a folder can contain items of different types. For example, by default, the Calendar folder can contain AppointmentItem and MeetingItem objects, and the Contacts folder can contain ContactItem and DistListItem objects. In general, when enumerating items in a folder, do not assume the type of an item in the folder; check the message class of the item before accessing properties that are applicable to the item.

Use the _Folders.Add method to add a folder to the Folders object. The Add method has an optional argument that can be used to specify the type of items that can be stored in that folder. By default, folders created inside another folder inherit the type of the parent folder.

Note that when items of a specific type are saved, they are saved directly into their corresponding default folder. For example, when the _MeetingItem.GetAssociatedAppointment method is applied to a MeetingItem in the Inbox folder, the appointment that is returned will be saved to the default Calendar folder.

See Also

Reference

Folder Members

Microsoft.Office.Interop.Outlook Namespace

Other Resources

How to: Create a Sendable Item for a Specific Account Based on the Current Folder

How to: Get the Account for a Folder

How to: Share Free/Busy Schedule Within a Specified Period in a Calendar

How to: Save a Calendar to Disk

How to: Add a Folder to the Folder List

How to: Enumerate Folders

How to: Get a Default Folder and Enumerate Its Subfolders

How to: Get a Folder Based on Its Folder Path

How to: Select a Folder and Display Folder Information

How to: Ensure that Custom Item Properties Are Supported in Folder-Level Queries

How to: Synchronize Outlook with a SharePoint Folder

How to: Use Arrays to Efficiently Enumerate Items in a Folder