Setting metadata using Azure C++ SDK


  • I'm trying to set metadata on a file in Azure blob storage using the following code:

    bool AzureUploader::uploadFile(const boost::filesystem::path& filePath) { auto leaf = filePath.filename(); azure::storage::cloud_blob_container container = blob_client.get_container_reference(U("my_container")); container.create_if_not_exists(); azure::storage::cloud_block_blob blockBlob = container.get_block_blob_reference(leaf.wstring()); auto filepathStr = filePath.wstring(); blockBlob.upload_from_file(filepathStr); blockBlob.download_attributes(); azure::storage::cloud_metadata md = blockBlob.metadata(); md[U("_timestamp")] = U("today"); blockBlob.upload_metadata(); }

    Yet when I look at the file in Azure Storage Explorer there is no metadata set. I've looked about a bit and this does seem to be the way to set metadata, but for whatever reason it's not working.

    Any ideas would be greatly appreciated!

    Tuesday, December 06, 2016 2:36 PM


All replies