Try to follow the steps below.
1.Create a console application project.
2.Install the SharePoint Online CSOM library using NuGet.
Install-Package Microsoft.SharePointOnline.CSOM -Version 16.1.8316.1200
3.Write the code like below to check if it works.
string siteUrl = "https://tenant.sharepoint.com/sites/lz";
var login = "[email protected]";
var password = "***";
var strServerRelativeURL = "/sites/lz/DL/MyTest.xlsx";
ClientContext context = new ClientContext(siteUrl);
var securePassword = new SecureString();
foreach (char c in password.ToCharArray()) securePassword.AppendChar(c);
context.Credentials = new SharePointOnlineCredentials(login, securePassword);
File csomFile=context.Web.GetFileByServerRelativeUrl(strServerRelativeURL);
context.Load(csomFile,
f => f.CheckOutType,
f => f.CheckedOutByUser,
f => f.ModifiedBy,
f => f.TimeCreated,
f => f.TimeLastModified);
context.ExecuteQuery();
Console.ReadLine();
If the code still not works, check if the file checked out, and check whether the checked out user and modified user are SharePoint Online users or not.