When I open a .docx file in Office 365 through Process.start() method using C# code, it opens the document in editing mode. when I do some changes and save the document, the mode change from editing to viewing. The same will not happen when I open the document directly from the physical location by double-clicking the document. This happened for .docx file. It is working fine for both above cases for .doc files which are opened in office 365.
//Open File
var runFile = new ProcessStartInfo(filePath) { Verb = "edit", UseShellExecute = true };
Process.Start(runFile);
When you open a .docx file in Office 365 through Process.start() method using C# code, it opens the document in editing mode and when you do some changes and save the document, the mode change from editing to viewing. this issue was caused because that .docx file is being used by another process or has not been completed the previous process yet on that .docx file. Before the document opens for editing make sure that file is used in another process or not.
.docx file does not allow editing while being used in any other process. In this case, Microsoft 365 automatically switches to Viewing mode from editing while trying to change and save a document.
you can use
Application.DoEvents();After .docx file change event.