none
How to get the leaseid for a blob

    Question

  • Hi

    I've search around and I can't find out how to get the leaseid for a blob I've looked in the properties of the blob but it doesn't seem to be there. Can anyone help me?

    Cheers

    David

    Wednesday, September 16, 2015 2:04 PM

Answers

All replies

  • LeaseID is the return value CloudBlob.AcquireLease method. 

    Please refer to documentation https://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.storage.blob.cloudblob.acquirelease.aspx 

    The REST API documentation is at  https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx?f=255&MSPPError=-2147217396

    Wednesday, September 16, 2015 4:35 PM
  • Hi Yuan

    Thanks for the reply!

    What about the situation where the blob already has a lease, but I want to see what the leaseid is?

    If I try to acquire a lease on a blob which already has a lease I'll get a 409 Conflict HTTP status code won't I?

    Cheers

    David

    Thursday, September 17, 2015 3:49 PM
  • Hi,

    Unfortunately there's no way to retrieve lease-id after the fact or in other words you get lease id back in response when you acquire the lease but not after that.

    Refer :http://blogs.technet.com/b/thbrown/archive/2015/04/04/there-is-currently-a-lease-on-the-blob-and-no-lease-id.aspx

    Thanks

    Abhishek

    • Marked as answer by David Midgley Thursday, September 17, 2015 5:07 PM
    Thursday, September 17, 2015 4:14 PM