I am trying to start excel with a file. It works fine when I run it with the same user. But with different user, only excel starts and that also with unknown error.
private void button1_Click(object sender, EventArgs e)
{
SecureString securePwd = new SecureString();
string password = "P@ssw0rd1";
SecureString sec_pass = new SecureString();
Array.ForEach(password.ToArray(), sec_pass.AppendChar);
sec_pass.MakeReadOnly();
ProcessStartInfo ps = new ProcessStartInfo();
ps.FileName = "c:\\Program Files\\Microsoft Office\\Office15\\EXCEL.EXE";
ps.Arguments = "c:\\test_folder\\test.xlsx";
ps.WorkingDirectory = "c:\\test_folder";
ps.Domain = "test.local";
ps.UserName = "testuser";
ps.Password = sec_pass;
ps.UseShellExecute = false;
Process.Start(ps);
}
The very same code works perfectly fine by changing the process from ps.FileName = "c:\Program Files\Microsoft Office\Office15\EXCEL.EXE"; to ps.FileName = "notepad.EXE";
had there be any rights issue even notepad.exe also should not work.