Below is my code to acquire lease on file in azure fileshare. Before acquiring lease, I need to check lease status of file.
var shareClient = new ShareClient(connectionString, "testfileshare");
shareClient.CreateIfNotExists();
var fileClient = shareClient.GetRootDirectoryClient().GetFileClient("test.xml");
var leaseClient = fileClient.GetShareLeaseClient();
//Lease status check to add here
var leaseId = leaseClient.Acquire();
leaseClient.Break();
Thanks.