什么时候在azure色中创建一个块blob?

blob引用包含一个Properties属性,其LastModifiedDateTimeOffset? 。 但是,我找不到blob的创建日期(时间)。 有没有我可以使用的标准API,或者我需要在meta中存储它?

  public async Task GetBlobMetaAsync(string blobId) { if (IsNullOrWhiteSpace(blobId)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(blobId)); var blob = await EnsureGetBlobById(blobId); await blob.FetchAttributesAsync(); string clientBlobName; blob.Metadata.TryGetValue(BlobNameMetaKey, out clientBlobName); var length = blob.Properties.Length; var md5 = blob.Properties.ContentMD5; var lastModified = blob.Properties.LastModified.Value.ToUniversalTime().DateTime; var dateCreated= blob.Properties.???????; return new AzureBlobMeta(blobId, clientBlobName, length, md5, dateCreated); } 

Created日期属性已添加到Storage Client Library中,从9.2.0版开始:

Blob:添加了对blob创建时间属性的支持。

(自18年5月23日起在Nuget上市 )

以下是它在BlobProperties.cs中的声明:

 ///  /// Gets the the creation time for the blob, expressed as a UTC value. ///  /// A  containing the blob's creation time, in UTC format. public DateTimeOffset? Created { get; internal set; } 

类型可以为null DateTimeOffset,与LastModified属性相同。


值的来源来自REST API中的x-ms-creation-time标头,该标头已在2017-11-09版本中添加 :

x-ms-creation-time版本2017-11-09和更新版本。 创建blob的日期/时间。 日期格式遵循RFC 1123。

有没有我可以使用的标准API,或者我需要在meta中存储它?

截至今天,您需要以blob元数据的forms存储此信息。 没有API会在创建blob时告诉您。 blob的Last Modified属性会告诉您上次修改blob的时间。 这可能是因为blob的内容已更改,或者其属性或元数据已更改。