Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub LaunchOutlook(ByVal UserName As String, ByVal SecurePassword As SecureString, ByVal Domain As String)
- Dim Impersonator As New ClsAuthenticator
- Try
- 'Impersonator.Impersonator(Domain, UserName, My.Application.CurrentUser.UserPass)
- Log.Add("LaunchOutlook: UserName " & UserName & " SecurePass Length: " & SecurePassword.Length & " Domain: " & Domain)
- Dim OutlookProcess() As Process = System.Diagnostics.Process.GetProcessesByName("outlook")
- If OutlookProcess.Count = 0 Then
- Dim PSI As New ProcessStartInfo
- PSI.UserName = UserName
- PSI.Password = SecurePassword
- PSI.Domain = Domain
- PSI.FileName = GetOutlookPath() & My.Settings.OutlookAppExe
- PSI.Arguments = My.Settings.OutlookAppArgs
- PSI.LoadUserProfile = True
- PSI.UseShellExecute = False
- OutlookProc.StartInfo = PSI
- OutlookProc.Start()
- End If
- Catch ex As Exception
- Log.Add("LaunchOutlook Failed: " & ex.Message)
- Throw New Exception("Unable to launch Outlook: " & ex.Message)
- Finally
- 'Impersonator.Undo()
- End Try
- End Sub
Add Comment
Please, Sign In to add comment