Guest User

Untitled

a guest
Feb 4th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. Private Sub LaunchOutlook(ByVal UserName As String, ByVal SecurePassword As SecureString, ByVal Domain As String)
  2. Dim Impersonator As New ClsAuthenticator
  3. Try
  4.  
  5. 'Impersonator.Impersonator(Domain, UserName, My.Application.CurrentUser.UserPass)
  6.  
  7. Log.Add("LaunchOutlook: UserName " & UserName & " SecurePass Length: " & SecurePassword.Length & " Domain: " & Domain)
  8. Dim OutlookProcess() As Process = System.Diagnostics.Process.GetProcessesByName("outlook")
  9. If OutlookProcess.Count = 0 Then
  10. Dim PSI As New ProcessStartInfo
  11. PSI.UserName = UserName
  12. PSI.Password = SecurePassword
  13. PSI.Domain = Domain
  14. PSI.FileName = GetOutlookPath() & My.Settings.OutlookAppExe
  15. PSI.Arguments = My.Settings.OutlookAppArgs
  16. PSI.LoadUserProfile = True
  17. PSI.UseShellExecute = False
  18.  
  19. OutlookProc.StartInfo = PSI
  20. OutlookProc.Start()
  21. End If
  22. Catch ex As Exception
  23. Log.Add("LaunchOutlook Failed: " & ex.Message)
  24. Throw New Exception("Unable to launch Outlook: " & ex.Message)
  25. Finally
  26. 'Impersonator.Undo()
  27. End Try
  28. End Sub
Add Comment
Please, Sign In to add comment