I am trying to set expiry for acquired leased as 1 min. This is my code
var shareClient = new ShareClient(connectionString, "testfileshare");
shareClient.CreateIfNotExists();
var fileClient = shareClient.GetRootDirectoryClient().GetFileClient("test.xml");
var leaseClient = fileClient.GetShareLeaseClient();
leaseClient.Acquire(TimeSpan.FromSeconds(60));
var leaseDuration = fileClient.GetProperties().Value.LeaseDuration;
With above code leaseDuration is set to infinite. I would like to set this to 1 min.
CodePudding user response:
It is not possible to set the lease duration for a file in a file share. You can only acquire an infinite lease on a file (though it is possible to acquire a finite lease on a file share).