I am making a app for SharePoint Online and in the app I have a function that deletes documents in a folder. But if someone have the document open or if the document is checked out the app crashes because the document the app cant get the document but its there. When i try to remove the "currently edited" document I get a error
"The file is currently checked out or locked for editing by another user"
And I cant remove the document for couple of hours. So is there a way to force delete a file/document in SharePoint Online by code? At the moment I use the code below to delete a folder.
foreach (Folder f in fcol)
{
if (f.Name == pDeleteRequest.RfcId)
{
f.DeleteObject();
break;
}
}