Microsoft Office Tutorials and References
In Depth Information
You have seen how to create a new contact item by using an object in Outlook
2007. Let's take a look at one of the most important contact management features in
Microsoft Office Outlook: the distribution list. A distribution list is a collection of
email contact information that has been grouped into a single list. VSTO helps Office
developers create and modify distribution lists by using the DistListItem object.
Let's create a distribution list dynamically, using the VSTO Outlook object model and
C# programming.
Open Visual Studio 2008 and create a new solution, as described earlier.
Write the following code, which will dynamically create a distribution list, inside
the ThisAddIn.cs file:
private void ThisAddIn_Startup(object sender, System.EventArgs e)
// Using the Outlook object reading through the Distribution item
// Preparing to create a new Distribution item
Outlook.DistListItem OutlookPacktDistributionList = (Outlook.
// Name the new distribution list
OutlookPacktDistributionList.DLName = "PacktContactList";
// To set the recipient information, create the mailitem
collect object
Outlook.MailItem PacktListItem = (Outlook.MailItem)this.
// Adding mail items
PacktListItem.Recipients.Add("Radhika Rajagopalan
PacktListItem.Recipients.Add("Vivek Thangaswamy
// Adding the recipients to the new distribution
// Save the new distribution using Save method
Search JabSto ::

Custom Search