Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

Blob creation date is null #970

@pcmalik

Description

@pcmalik

Which service(blob, file, queue, table) does this issue concern?

blob

Which version of the SDK was used?

WindowsAzure.Storage 9.3.3

Which platform are you using? (ex: .NET Core 2.1)

.NET Core 3.1

What problem was encountered?

blob 'Created' date is null when stream content is uploaded to blob store using UploadFromStreamAsync method

How can we reproduce the problem in the simplest way?

Below method 'UploadAsync' is returning null value in 'Created' field:

    public async Task<DateTime?> UploadAsync(string filename, Stream stream)
    {
        var blobReference = await GetBlobReferenceAsync(filename);
        await blobReference.UploadFromStreamAsync(stream);

        return Convert.ToDateTime(blobReference.Properties.Created.ToString(), CultureInfo.CurrentCulture);
    }

    private async Task<CloudBlockBlob> GetBlobReferenceAsync(string filename)
    {
        var storageCredentials = new StorageCredentials(_blobSettings.AccountName, _blobSettings.AccountKey);
        var storageAccount = new CloudStorageAccount(storageCredentials, useHttps: true);
        var blobClient = storageAccount.CreateCloudBlobClient();
        var blobContainer = blobClient.GetContainerReference(_blobSettings.ContainerName);
        await blobContainer.CreateIfNotExistsAsync();
        var blobReference = blobContainer.GetBlockBlobReference(filename);

        return blobReference;
    }

Have you found a mitigation/solution?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions