THX for your offer, but I think it's way too complex a setup and lots of setting up parameters to explain for you to get it to work if you should have the whole code.
Not that I don't want to share my code, but it's way too special and I think the 'explaining' will be around YOU to understand what I mean in my explaining and code ;-)
My first language is DANISH so detailed explaining in english/american will be a little wierd I think ;-)
I think I hvae isolated the problems to the way I STOP and START Outlook and I have tried different codes for that too:
Here is my code for STOPPING - in the first place I just used KILL() (why not go for the heart !), then CloseMainWindow() and then I use a "nicer" method - told by someone in a C# Forum out there:
private static Boolean StopExecutionOf(String r)
{
foreach (Process clsProcess in Process.GetProcesses())
{
if (clsProcess.ProcessName.ToLower() == r.ToLower())
{
try
{
clsProcess.Kill(); // CloseMainWindow();
}
catch
{
return false;
}
return true;
}
}
return false;
}
private static void EndProcessTree(string imageName)
{
// Just some CUT/PASTE from out there !!!
// but it 'stops' the process !
Process.Start(new ProcessStartInfo
{
FileName = "taskkill",
Arguments = $"/im {imageName} /f /t",
CreateNoWindow = true,
UseShellExecute = false
}).WaitForExit();
}
Here are my code for STARTing Outlook again:
ProcessStartInfo startInfo = new ProcessStartInfo("Outlook.exe")
{
WindowStyle = ProcessWindowStyle.Minimized
};
Process.Start(startInfo);
Hope this can tell you something I don't see - it's SO annoying not to have it working with Scheduler - I think Scheduler was made for just such tasks - right ?