R
Rodrigo
HI! Please Forgive my english!!!
I need to create a Distribution list with some contacts in a public folders.
This contacts are market in several categories. I need to create one
distribution list for each categories i have.
When i create the distribution list and use the method "AddMember", only
Name and SMTP address are stored in Distribution List. but... can i link
the vcard of the contacts as are linked with "Select Members" buttons in
Distribution List Window?
This is the "beta" script
Dim myOlApp As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myContactFolder As Outlook.MAPIFolder
Dim myDistList As Outlook.DistListItem
Dim myTempItem As Outlook.MailItem
Dim myRecipients As Outlook.Recipients
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myTempItem = myOlApp.CreateItem(olMailItem)
Set myDistList = myOlApp.CreateItem(olDistributionListItem)
Set myRecipients = myTempItem.Recipients
SeleccionarContactFolder:
Set myContactFolder = myNameSpace.PickFolder
myDistList.DLName = TextBox1.Text
If myContactFolder.DefaultItemType <> olContactItem Then
MsgBox ("Please Select a contact Folder")
GoTo selectContactFolder:
End If
Dim myContact As Outlook.ContactItem
Dim myContactItems As Outlook.Items
Debug.Print (myContactFolder.Items.Count)
Set myContactItem = myContactFolder.Items
On Error goto Error_Handler
For Each myContact In myContactItem
If myContact.Email1Address <> "" Then
myRecipients.Add myContact.Email1Address
Debug.Print (" Name" & myContact.FullName & ", categories " &
myContact.Categories )
myDistList.AddMembers myRecipients
End If
Skip_section:
Next
myDistList.Subject = TextBox1.Text
showContactProgress.Visible = False
myDistList.Display
showContactProgress.Visible = True
myDistList.Save
Exit Sub
Error_handler:
Resume Skip_section
Thanks in Advance!
Rodrigo de los Santos
delossantos at ineba dot net
I need to create a Distribution list with some contacts in a public folders.
This contacts are market in several categories. I need to create one
distribution list for each categories i have.
When i create the distribution list and use the method "AddMember", only
Name and SMTP address are stored in Distribution List. but... can i link
the vcard of the contacts as are linked with "Select Members" buttons in
Distribution List Window?
This is the "beta" script
Dim myOlApp As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myContactFolder As Outlook.MAPIFolder
Dim myDistList As Outlook.DistListItem
Dim myTempItem As Outlook.MailItem
Dim myRecipients As Outlook.Recipients
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myTempItem = myOlApp.CreateItem(olMailItem)
Set myDistList = myOlApp.CreateItem(olDistributionListItem)
Set myRecipients = myTempItem.Recipients
SeleccionarContactFolder:
Set myContactFolder = myNameSpace.PickFolder
myDistList.DLName = TextBox1.Text
If myContactFolder.DefaultItemType <> olContactItem Then
MsgBox ("Please Select a contact Folder")
GoTo selectContactFolder:
End If
Dim myContact As Outlook.ContactItem
Dim myContactItems As Outlook.Items
Debug.Print (myContactFolder.Items.Count)
Set myContactItem = myContactFolder.Items
On Error goto Error_Handler
For Each myContact In myContactItem
If myContact.Email1Address <> "" Then
myRecipients.Add myContact.Email1Address
Debug.Print (" Name" & myContact.FullName & ", categories " &
myContact.Categories )
myDistList.AddMembers myRecipients
End If
Skip_section:
Next
myDistList.Subject = TextBox1.Text
showContactProgress.Visible = False
myDistList.Display
showContactProgress.Visible = True
myDistList.Save
Exit Sub
Error_handler:
Resume Skip_section
Thanks in Advance!
Rodrigo de los Santos
delossantos at ineba dot net