Folder Object
Outlook Developer Reference |
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
- Outlook Object Model Reference
- Folder Object Members
- How to: Add a Custom Folder to a Group and Display it in Overlay Mode by Default
- How to: Add a Folder to the Favorite Folders Group
- How to: Create a Rule to Move Specific E-mails to a Folder
- How to: Delete Data to Reset Solution Storage
- How to: Enumerate Folders on All Stores
- How to: Enumerate Search Folders on All Stores
- How to: Export a Calendar using Payload Sharing
- How to: Filter Items that Do Not Have Categories
- How to: Import Saved Items using OpenSharedItem
- How to: Obtain a Folder Object from a Folder Path
- How to: Programatically Change the Display Format for All Contacts
- How to: Send a Sharing Invitation for a Calendar
- How to: Store Data in a StorageItem for a Solution
- How to: Use the Table Object to Performantly Enumerate Filtered Items in a Folder
- How-to: Enumerate the Contacts Folder and Set Custom Property for only Contact Items