Skip to content

Instantly share code, notes, and snippets.

@clijsters
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save clijsters/458dbb82ece7902b6c25 to your computer and use it in GitHub Desktop.

Select an option

Save clijsters/458dbb82ece7902b6c25 to your computer and use it in GitHub Desktop.

Revisions

  1. clijsters revised this gist Jul 14, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion ResolveRecipient.vb
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,8 @@
    Function ResolveRecipient(strSearch As String) As Outlook.Recipient
    If String.IsNullOrEmpty(strSearch) Then
    Throw New Exception("Empty string was given to ResolveRecipient Function.", New NullReferenceException("strSearch at ResolveRecipient IsNullOrEmpty"))
    Throw New Exception _
    ("Empty string was given to ResolveRecipient Function.", _
    New NullReferenceException("strSearch at ResolveRecipient IsNullOrEmpty"))
    End If
    Dim App As Outlook.Application = New Outlook.Application
    Dim NS As Outlook.NameSpace = App.Session
  2. clijsters created this gist Jul 14, 2015.
    13 changes: 13 additions & 0 deletions ResolveRecipient.vb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    Function ResolveRecipient(strSearch As String) As Outlook.Recipient
    If String.IsNullOrEmpty(strSearch) Then
    Throw New Exception("Empty string was given to ResolveRecipient Function.", New NullReferenceException("strSearch at ResolveRecipient IsNullOrEmpty"))
    End If
    Dim App As Outlook.Application = New Outlook.Application
    Dim NS As Outlook.NameSpace = App.Session
    Dim rec As Outlook.Recipient = NS.CreateRecipient(strSearch)
    If rec.Resolve Then
    Return rec
    Else
    Throw New Exception("Unable to resolve Recipient")
    End If
    End Function