Microsoft Office Tutorials and References
In Depth Information
// PacktNameSpace.Folders is a collection of all the folders
// We want to delete the 13th folder, FolderPackt
Outlook.MAPIFolder PacktFolders = PacktNameSpace.Folders;
// Getting the folder named FolderPackt
PacktFolders.Name = "FolderPackt";
// Doing the delete operation using Delete method
Contacts contain information about communication with a person. The information
can be their address, name, phone number, and other relevant information. The
Contacts folder in Microsoft Office Outlook 2007 is the electronic form of managing
contact information about people. Outlook offers the ability to very easily manage
multiple phone numbers and more information for a single person. Outlook provides
better management of contact entries and brings easy access through the information
available in the Contacts folder.
In certain situations, you may need to add or modify the contact entries dynamically.
To support these features, Microsoft provides a solution through VSTO 3.0
programming to allow Office developers to build application-level add-ins,
which will help you integrate custom developed solutions.
We will now create a contact item using the VSTO 3.0 object model and C#.
Open Visual Studio 2008 and create a new solution, as explained earlier.
Write the following code, which will dynamically create a contact item in
the ThisAddIn.cs file.
private void ThisAddIn_Startup(object sender, System.EventArgs e)
// Using the Outlook object reading through the contact item
// Preparing to create a new contact item
Outlook.ContactItem OutlookPacktContact = (Outlook.
// Set FirstName property
OutlookPacktContact.FirstName = "Radhika";
// Set LastName property
OutlookPacktContact.LastName = "Rajagopalan";
// Set Email1Address property