H
HU Steiner
Hallo
I am programming a VBA-Solution for Export and Import Contacts,
inclusive Distributionslist to and from a Access-DB.
After a lot of minor problems (thanks Sue Mosher and other for the most
solutions) is one without solution:
Cascaded DistributionLists:
- DL1
- Henry Miller
- Sue Mosher
- DL3
- DL1
- Fritz Keller
- Dagobert Duck
I am not able to add DL1 as Member to DL3.
I have tested without 'MAPIPDL:' too.
The Debug.Print Msg ist Resolve impossible'.
My Code below (shorted and simplified):
Thanks
Hans
Dim oApp As Outlook.Application
Dim oNS As Outlook.NameSpace
Dim oMFolder As MAPIFolder
Dim oDL As Outlook.DistListItem
Dim oRecipients As Outlook.MailItem 'Recipients-Objekt
für Add
Dim oRecip As Outlook.Recipients 'Recipient-Objekt
Dim xK As Integer
Dim sDLLast As String
Dim sName As String
Dim sNameE As String 'expadded
Dim sEMail As String
Dim sEMailTyp As String
Dim aryK(5, 4) As String
' DL 1
aryK(0, 0) = "DL1"
aryK(0, 1) = "Henry Miller"
aryK(0, 2) = "(e-mail address removed)"
aryK(0, 3) = "SMTP"
aryK(1, 0) = "DL1"
aryK(1, 1) = "Sue Mosher"
aryK(1, 2) = "(e-mail address removed)"
aryK(1, 3) = "SMTP"
' DL 2
aryK(2, 0) = "DL2"
aryK(2, 1) = "Dagobert Duck"
aryK(2, 2) = "(e-mail address removed)"
aryK(2, 3) = "SMTP"
aryK(3, 0) = "DL2"
aryK(3, 1) = "DL1" 'Sub-DL
aryK(3, 2) = ""
aryK(3, 3) = "MAPIPDL"
aryK(4, 0) = "DL99999"
Set oApp = CreateObject("Outlook.Application.11")
Set oNS = oApp.GetNamespace("MAPI")
Set oMFolder = oNS.GetDefaultFolder(olFolderContacts)
For xK = 0 To 3
If aryK(xK, 0) <> sDLLast Then 'new DL
Set oDL = oApp.CreateItem(olDistributionListItem)
oDL.DLName = aryK(xK, 0)
Set oRecipients = oApp.CreateItem(olMailItem)
Set oRecip = oRecipients.Recipients
sDLLast = aryK(xK, 0)
End If
sName = aryK(xK, 1)
sEMail = aryK(xK, 2)
sEMailTyp = aryK(xK, 3)
If sEMailTyp = "MAPIPDL" Then ' Sub-DL
sNameE = "MAPIPDL:" & sName ' <--- ????
Else
sNameE = sName & " (" & sEMail & ")"
End If
oRecip.Add sNameE
If oRecip.ResolveAll = True Then
If oRecip(1).Address <> "" Then
oDL.AddMembers oRecip
Else
Debug.Print "Adress missing: " & sNameE & " EMail: " & sEMail
End If
Else
Debug.Print "Resolve impossible: " & sNameE & " EMail: " & sEMail
End If
oRecip.Remove (1)
If aryK(xK + 1, 0) <> sDLLast Then 'next new DL
oDL.Save
End If
Next
I am programming a VBA-Solution for Export and Import Contacts,
inclusive Distributionslist to and from a Access-DB.
After a lot of minor problems (thanks Sue Mosher and other for the most
solutions) is one without solution:
Cascaded DistributionLists:
- DL1
- Henry Miller
- Sue Mosher
- DL3
- DL1
- Fritz Keller
- Dagobert Duck
I am not able to add DL1 as Member to DL3.
I have tested without 'MAPIPDL:' too.
The Debug.Print Msg ist Resolve impossible'.
My Code below (shorted and simplified):
Thanks
Hans
Dim oApp As Outlook.Application
Dim oNS As Outlook.NameSpace
Dim oMFolder As MAPIFolder
Dim oDL As Outlook.DistListItem
Dim oRecipients As Outlook.MailItem 'Recipients-Objekt
für Add
Dim oRecip As Outlook.Recipients 'Recipient-Objekt
Dim xK As Integer
Dim sDLLast As String
Dim sName As String
Dim sNameE As String 'expadded
Dim sEMail As String
Dim sEMailTyp As String
Dim aryK(5, 4) As String
' DL 1
aryK(0, 0) = "DL1"
aryK(0, 1) = "Henry Miller"
aryK(0, 2) = "(e-mail address removed)"
aryK(0, 3) = "SMTP"
aryK(1, 0) = "DL1"
aryK(1, 1) = "Sue Mosher"
aryK(1, 2) = "(e-mail address removed)"
aryK(1, 3) = "SMTP"
' DL 2
aryK(2, 0) = "DL2"
aryK(2, 1) = "Dagobert Duck"
aryK(2, 2) = "(e-mail address removed)"
aryK(2, 3) = "SMTP"
aryK(3, 0) = "DL2"
aryK(3, 1) = "DL1" 'Sub-DL
aryK(3, 2) = ""
aryK(3, 3) = "MAPIPDL"
aryK(4, 0) = "DL99999"
Set oApp = CreateObject("Outlook.Application.11")
Set oNS = oApp.GetNamespace("MAPI")
Set oMFolder = oNS.GetDefaultFolder(olFolderContacts)
For xK = 0 To 3
If aryK(xK, 0) <> sDLLast Then 'new DL
Set oDL = oApp.CreateItem(olDistributionListItem)
oDL.DLName = aryK(xK, 0)
Set oRecipients = oApp.CreateItem(olMailItem)
Set oRecip = oRecipients.Recipients
sDLLast = aryK(xK, 0)
End If
sName = aryK(xK, 1)
sEMail = aryK(xK, 2)
sEMailTyp = aryK(xK, 3)
If sEMailTyp = "MAPIPDL" Then ' Sub-DL
sNameE = "MAPIPDL:" & sName ' <--- ????
Else
sNameE = sName & " (" & sEMail & ")"
End If
oRecip.Add sNameE
If oRecip.ResolveAll = True Then
If oRecip(1).Address <> "" Then
oDL.AddMembers oRecip
Else
Debug.Print "Adress missing: " & sNameE & " EMail: " & sEMail
End If
Else
Debug.Print "Resolve impossible: " & sNameE & " EMail: " & sEMail
End If
oRecip.Remove (1)
If aryK(xK + 1, 0) <> sDLLast Then 'next new DL
oDL.Save
End If
Next