'How I can check lease status before acquiring lease on file in azure fileshare?

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.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source