C# how to open a file that is locked by another process
| Posted in Programming
If the file is locked by the process exclusively, it is not possible to open those files. But if the process holds only shared lock, we can open the file using c# using the following code
FileStream objf = new FileStream(”Ouput.xls”, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
Excel hold the shared lock on the files.
|