Azure Storage API ContentDisposition

前端 未结 1 923
既然无缘
既然无缘 2020-12-04 01:45

I see that Azure has release the ContentDisposition property of a blob: http://msdn.microsoft.com/en-us/library/windowsazure/microsoft.windowsazure.storage.blob.blobproperti

相关标签:
1条回答
  • 2020-12-04 02:03

    Can you please check the DefaultServiceVersion for your storage account? For Content-Disposition to work, I believe the DefaultServiceVersion should be 2013-08-15.

    To get DefaultServiceVersion:

        var cloudStorageAccount = new CloudStorageAccount(new StorageCredentials("accountname", "accountkey"), false);
        var serviceProperties = cloudStorageAccount.CreateCloudBlobClient().GetServiceProperties();
        var serviceVersion = serviceProperties.DefaultServiceVersion;
    

    To set DefaultServiceVersion:

        var cloudStorageAccount = new CloudStorageAccount(new StorageCredentials("accountname", "accountkey"), false);
        var serviceProperties = cloudStorageAccount.CreateCloudBlobClient().GetServiceProperties();
        serviceProperties.DefaultServiceVersion = "2013-08-15";
        cloudStorageAccount.CreateCloudBlobClient().SetServiceProperties(serviceProperties);
    

    Once you set DefaultServiceVersion, it should work.

    0 讨论(0)
提交回复
热议问题