共用方式為


Folder Object (Outlook)

Represents an Outlook folder.

Version Information

Version Added: Outlook 2007

Remarks

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 Folder.Folders property, which returns the set of folders underneath a Folder object in the hierarchy, and the Folders.Item method, 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

Concepts

Outlook Object Model Reference

Folder Object Members