Issue opening file using WinForms application (Open file dialog) where file location is OneDrive
Eswar Chaitanya Darsi
1
Reputation point
Hi,
I am seeing an issue with File Open Dialog when I try to open a file from OneDrive location mapped on my machine.
Issue / Steps to reproduce:
- Copy any file (ex: excel file) to OneDrive
- Double click and open the file from OneDrive location to edit
- From any windows forms application (.NET Framework 4.8), when I try to open the same file using File dialog window I get an error message "This file is in use. Enter a new name or close the file that's open in another program" public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
openFileDialog1 = new OpenFileDialog();
}private void button1_Click(object sender, EventArgs e) { openFileDialog1.InitialDirectory = "C:\\"; var result = openFileDialog1.ShowDialog(); if(result == DialogResult.OK) textBox1.Text = openFileDialog1.FileName; } }
This issue is not reproducible when I open the file from any local/network shared directory.
Sign in to answer