什么时候在azure色中创建一个块blob?
blob引用包含一个Properties
属性,其LastModified
为DateTimeOffset?
。 但是,我找不到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的内容已更改,或者其属性或元数据已更改。
- 将Azure ServiceBus上的消息从.NET Core发送器发送到.NET 4.6处理程序
- Windows Azure入门
- 具有Http触发函数的连续Azure WebJob
- 如何通过AADvalidationAzure服务管理请求
- AuthenticationContext.AcquireTokenAsync是C#的新手
- 为什么上传到Azure blob这么慢?
- Azure Functions .NET Core中的EF Core 2.0连接字符串
- 如何在Azure中执行区分大小写的LINQ查询?
- 异步调用时,Azure KeyVault Active Directory AcquireTokenAsync超时