| 

.NET C# Java Javascript Exception

2
Wenn ein Name mit resolveAll() nicht aufgelöst werden kann, will ich mit dem SelectNamesDialog den Namen entsprechend suchen und auswählen. Soweit so gut. Habe ein Beispiel gefunden, wo der zu suchende Name in Outlook.OlRecipientSelectors.olShowTo geschrieben wird.
Wie kriege ich es hin, dass das Suchfeld oben in SelectNamesDialog mit dem zu suchenden Namen gefüllt wird.
Dim objOutlook As Outlook.Application = GetApplicationObject()
Dim myRecipient As Outlook.Recipient
Dim myRecipients As Outlook.Recipients
Dim myMail As Outlook.MailItem

Try
myMail = CType(objOutlook.CreateItem(Outlook.OlItemType.olMailItem), Outlook.MailItem)
myRecipients = myMail.Recipients
myRecipients.Add("Mayer, Max")
myRecipients.ResolveAll()
For Each myRecipient In myRecipients
If myRecipient.Resolved Then
Debug.Print(myRecipient.Address & " - " & myRecipient.Name)
userName = myRecipient.Name
Exit For
Else
Debug.Print("Alias für: " & userName & " konnte nicht aufgelöst werden!")
For i As Integer = 1 To myRecipients.Count
Dim snd As Outlook.SelectNamesDialog = objOutlook.Session.GetSelectNamesDialog()
snd.Recipients.Add(userName)
snd.NumberOfRecipientSelectors = Outlook.OlRecipientSelectors.olShowTo
snd.AllowMultipleSelection = False
snd.Display()
If Not (snd.Recipients.ResolveAll()) Then
myRecipients.Remove(i)
userName = ""
Exit For
Else
myRecipients.Remove(i)
myRecipients.Add(snd.Recipients(1).Name)
userName = snd.Recipients(1).Name
Exit For
End If
Next
End If
Next
Catch ex As Exception
Debug.Print(ex.ToString)
End Try
News:
13.06.2022
TOP TECHNOLOGIES CONSULTING GmbH