Thanks melvik for your reply.
I use this code which i found on msdn but still doens't work quit well... It creates the distribution list and inserts the first item from my listbox but nothing more...
ApplicationClass myApp = new ApplicationClass() ;
NameSpace ns = myApp.GetNamespace("MAPI") ;
Outlook.DistListItem myDistList ;
Outlook.MailItem objItem =
(Outlook.MailItem)myApp.CreateItem(OlItemType.olMa ilItem);
myDistList
=(Outlook.DistListItem)myApp.CreateItem(OlItemType .olDistributionListItem) ;
myDistList.DLName = cmb_curs.SelectedItem.ToString() ;
myDistList.Body = cmb_curs.SelectedItem.ToString() ;
foreach(string item in lstb_SelcUsrs.SelectedItems)
{
objItem.Recipients.Add(item) ;
}
objItem.Recipients.ResolveAll() ;
myDistList.AddMembers(objItem.Recipients) ;
myDistList.Save() ;
|