none
Setting the user defined metadata using C++ Azure SDK APIs

    Question

  • Hi,

    Is there a way to set the user defined metadata when uploading a blob using C++ Azure SDK APIs? I tried looking around the cloud_block_blob (http://azure.github.io/azure-storage-cpp/classazure_1_1storage_1_1cloud__block__blob.html) class but couldn't find a way to do so.

    Thanks.

    Wednesday, February 10, 2016 10:22 PM

Answers

  • Hello markovmon,

    You would need to do something like:

    blob.metadata()[U("key")] = U("value");

    blob.upload_metadata(); // Or one or its overloads

    Hope this helps,

    Thanks,

    Sriprasad

    Friday, February 12, 2016 10:50 PM
  • Sriprasad's method is correct.  cloud_blob::metadata is an unordered map for custom metadata.  Please note upload_metadata() is not an upsert operation.  If a "key-value" pair is not in the blob metadata, upload_metadata() will remove the pair from service.
    • Marked as answer by markovmon Saturday, February 20, 2016 12:12 AM
    Wednesday, February 17, 2016 4:41 AM

All replies