Last active
August 29, 2015 14:24
-
-
Save Clijsters/458dbb82ece7902b6c25 to your computer and use it in GitHub Desktop.
A simple VB solution to search for Users in Exchange via Outlook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
At this point you could gather information on this way: