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

359 views Asked by At

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.

0

There are 0 answers