How do I... (Outlook 2013 PIA reference)
This section contains procedural tasks topics and code examples in Visual Basic and C# that demonstrate how to perform some common tasks in Outlook.
To run these code examples, you must have installed Outlook 2010 and Visual Studio 2008, or a later version of these products.
The code examples in this section do not require that you have installed Office Developer Tools for Visual Studio. However, you can refer to the Getting started with Office development portal for information about using the tools, and refer to Outlook solutions for some basic how-to tasks written in managed code.
Code examples in this section range from the beginner to the intermediate levels, and some of them are adapted from the book Programming Applications for Microsoft Office Outlook 2007.
The Office Developer Documentation team welcomes your task ideas and code samples. If we use your code samples in Outlook content, we will recognize your work with a byline and a link to your website. For more information, contact us at docthis@microsoft.com.
In this section
- Get account information
- Create a sendable item for a specific account based on the current folder
- Get the account for a folder
- Get information about multiple accounts
- Send a mail item by using a Hotmail account
- Display in the Select Names dialog box the address book corresponding to a Contacts folder
- Get the Global Address List or a set of address lists for a store
- Enumerate the entries in the Global Address List
- Display the address lists for a profile
- Create an appointment that is an all-day event
- Create an appointment that starts in the Pacific Time Zone and ends in the Eastern Time Zone
- Specify different recipient types for an appointment item
- Create a recurring appointment by using the default recurrence pattern
- Create a recurring appointment that has a weekly pattern
- Create an annual recurring appointment that uses a YearNth pattern
- Find a specific appointment in a recurring appointment series
- Create an exception appointment in a recurring appointment series
- Create a reminder for an appointment item
- Import appointment XML data into Outlook appointment objects
- Attach a file to a mail item
- Attach an Outlook Contact item to an email message
- Limit the size of an attachment to an Outlook email message
- Modify an attachment of an Outlook email message
- Programmatically remove security level 2 attachments from messages and save them to disk
- Share Free/Busy schedule within a specified period in a calendar
- Share calendar information through email
- Display a shared calendar of a recipient
- Save a calendar to disk
- Open and display the contents of an iCalendar file
- Create a Contact item
- Create a custom Contact item
- Create a Contact item from a vCard file and save the item in a folder
- Get information about the current user
- Get information about all distribution lists of which the current user is a member
- Create a distribution list
- Get members of an Exchange distribution list
- Get information about the current user's manager
- Get availability information for an Exchange user's manager
- Check a manager's response to a meeting request
- Get information about direct reports of the current user's manager
- Add a folder to the folder list
- Enumerate folders
- Get a default folder and enumerate its subfolders
- Get a folder based on its folder path
- Select a folder and display folder information
- Get the default message class of a folder
- Access solution-specific data stored as a hidden message in a folder
- Ensure that custom item properties are supported in folder-level queries
- Create a Helper class to access common Outlook item members
- Display selected items in the active Explorer
- Create a mail item by using a message template
- Create a mail item, attach a report, and send the mail item to the user's manager
- Send an email given the SMTP address of an account
- Add voting options to a mail item
- Add a custom action as a response to a mail item
- Get the SMTP address of the sender of a mail item
- Specify different recipient types for a mail item
- Create a meeting request, add recipients, and specify a location
- Get the organizer of a meeting
- Check all responses to a meeting request
- Find the appointment item associated with a meeting request
- Automatically accept a meeting request
- Prompt a user to respond to a meeting request
- Display the Select Names dialog box to resolve recipients
- Use the Select Names dialog box to obtain and assign recipients to an appointment
- Get the email address of a recipient
- Create a rule to file mail items from a manager and flag them for follow-up
- Execute a rule instantly
- Execute a rule on a local computer
- Create a rule to assign categories to mail items based on multiple words in the subject
Sample tasks using Outlook events
- Filter and efficiently enumerate items in a folder
- Use SetColumns to efficiently enumerate items in a folder
- Use arrays to efficiently enumerate items in a folder
- Enumerate items in the Inbox based on the last modification time
- Filter and display Inbox items modified in the last month
- Filter and display multivalued properties when enumerating items in a folder
- Filter and display computed properties when enumerating items in a folder
- Enumerate hidden items in a folder
- Use instant search to search all folders and all stores for a phrase in the subject
- Search for a phrase in the body of items in a folder
- Search attachments of items in a folder for an exact phrase
- Search and obtain appointments in a time range
- Filter recurring appointments and search for a string in the subject
- Search and obtain items in an aggregated view