Microsoft Office Tutorials and References
In Depth Information
Manipulation
Folders
Folders are the containers that hold file items and sub folders inside the main
folder. Folders are used to manage mail items to make them easily accessible inside
Outlook. In Outlook 2007, you can manage mail items, contact items, and other
communication information.
Let's start working with the Outlook folder using VSTO 3.0 and C#.NET
programming. The following code will create a folder with your desired name, by
using VSTO object models.
1. Open Visual Studio 2008 to create a new Outlook 2007 Add-in
template project.
2. Select New Project . Under Office select 2007 , and then select Outlook 2007
Add-in template and name the project as per your requirement.
3. The solution will be created with all of the supporting files required for the
development of our Outlook solution.
4. Enter the following code, which will dynamically create a folder, inside the
ThisAddIn.cs file:
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
// Get the namespace for Outlook operation
Outlook.NameSpace ReadOutLookNameSpace = this.Application.
GetNamespace("MAPI");
// Get the default folder names from the Outlook
Outlook.MAPIFolder ReadDefaultFolders = ReadOutLookNameSpace.
GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
// Create folder in the "FolderPacktPub"
ReadDefaultFolders = this.Application.Session.Folders[1].
Folders.Add("FolderPacktPub", missing);
}
 
Search JabSto ::




Custom Search