T
Tom_Joseph2
Guest
Hello,
I have an app in VB.NET where I let any user login using their Active Dir a/c and the app lets user access their mail using the Outlook. I use WinApi. I launch Outlook using Process class. Here's my code:
Private Sub LaunchOutlook(ByVal UserName As String, ByVal SecurePassword As SecureString, ByVal Domain As String)
Dim Impersonator As New ClsAuthenticator
Try
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
'Impersonator.Impersonator(Domain, UserName, My.Application.CurrentUser.UserPass)
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()
Impersonator = Nothing
End Try
End Sub
The problem that I am facing is - in Win 10 when user logs in and opens Outlook user can open any file attachment type except PDF. Some how, I am not able to open the PDF file. PDF file can be Preview, Copy but not opened.
I tried Impersonate, but it doesn't work. If I added the Impersonate line before creating the Process, it would open the mailbox of the system logged user and not the application logged user. And If I put Impersonate line where it is right now, it gives "Access Denied" error. Any idea how do can I make PDF files open as normal using the default app like Edge, any PDF reader. Any help is highly appreciated.
Thanks
Tom
Continue reading...
I have an app in VB.NET where I let any user login using their Active Dir a/c and the app lets user access their mail using the Outlook. I use WinApi. I launch Outlook using Process class. Here's my code:
Private Sub LaunchOutlook(ByVal UserName As String, ByVal SecurePassword As SecureString, ByVal Domain As String)
Dim Impersonator As New ClsAuthenticator
Try
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
'Impersonator.Impersonator(Domain, UserName, My.Application.CurrentUser.UserPass)
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()
Impersonator = Nothing
End Try
End Sub
The problem that I am facing is - in Win 10 when user logs in and opens Outlook user can open any file attachment type except PDF. Some how, I am not able to open the PDF file. PDF file can be Preview, Copy but not opened.
I tried Impersonate, but it doesn't work. If I added the Impersonate line before creating the Process, it would open the mailbox of the system logged user and not the application logged user. And If I put Impersonate line where it is right now, it gives "Access Denied" error. Any idea how do can I make PDF files open as normal using the default app like Edge, any PDF reader. Any help is highly appreciated.
Thanks
Tom
Continue reading...