Please can anyone tell me if it is possible to you the links collection with a distribution list. I am trying to programatically add an existing contact to an existing distribution list using this code:
Dim myOlApp As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Dim myDistList As Outlook.DistListItem
Dim myContact As Outlook.ContactItem
Set myDistList = myOlApp.CreateItem(olDistributionListItem)
Set myNameSpace = myOlApp.GetNamespace("MAPI"
Set myFolder = myNameSpace.GetDefaultFolder_(olFolderContacts)
tempstr = InputBox("Enter the name of the contact to link_ to this task"
If tempstr <> "" Then
tempstr = "[Full Name] = """ & tempstr & """"
Set myItems = myFolder.Items.Restrict("[MessageClass]_ = 'IPM.Contact'"
Set myContact = myItems.Find(tempstr)
myDistList.Links.Add myContact
myDistList.Display
This creates a distribution list but does not add the existing contact??
After looking high and low, i have not found any this to say this is not possible.
Please help
Regards
Mark
Dim myOlApp As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Dim myDistList As Outlook.DistListItem
Dim myContact As Outlook.ContactItem
Set myDistList = myOlApp.CreateItem(olDistributionListItem)
Set myNameSpace = myOlApp.GetNamespace("MAPI"
Set myFolder = myNameSpace.GetDefaultFolder_(olFolderContacts)
tempstr = InputBox("Enter the name of the contact to link_ to this task"
If tempstr <> "" Then
tempstr = "[Full Name] = """ & tempstr & """"
Set myItems = myFolder.Items.Restrict("[MessageClass]_ = 'IPM.Contact'"
Set myContact = myItems.Find(tempstr)
myDistList.Links.Add myContact
myDistList.Display
This creates a distribution list but does not add the existing contact??
After looking high and low, i have not found any this to say this is not possible.
Please help
Regards
Mark