Add contact to DistListItem in a Public Folder

  • Thread starter Thread starter Anthony Vannier
  • Start date Start date
A

Anthony Vannier

I use Exchange 2000, and this code fill DistList in a local folder but not
in public folder :


Dim oItemList As DistListItem
Dim oItemContact As Outlook.ContactItem
Dim oItemRecipient As Outlook.Recipient
Dim oItemRecipients As Outlook.Recipients

'Contact
Set oItemContact = oOutlook.GetItemFromID(m_strEnrtyId, m_strStoreId)

'DistList
Set oItemList = oFolder.Items.Add(olDistributionListItem)

oItemList.DLName = "Cadeaux"
Set oItemMail = oOutlook.Application.CreateItem(olMailItem)
Set oItemRecipients = oItemMail.Recipients
Set oItemRecipient = oItemRecipients.Add(oItemContact)

oItemList.AddMembers oItemRecipients

oItemList.Save


Can you help me ?

Thanks
 
It works fine here, although this statement may be problematic:

Set oItemRecipient = oItemRecipients.Add(oItemContact)

Recipients.Add takes a name or email address as its argument, not a
ContactItem.

How are you instantiating oFolder?

FYI, there is a newsgroup specifically for general Outlook programming
issues "down the hall" at microsoft.public.outlook.program_vba or, via web
interface, at
http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.outlook.program_vba
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top