我需要获取 blob 属性,其中有最后修改日期。我需要日期来进行比较。阅读了很多文章,并认为这是因为我没有使用 CloudBlockBlob,但我无法从中提取属性。
到目前为止,我的代码返回了 blob 的名称:
public static void ListBlobsAnonymously()
{
//Get the blob from the URL - URL is in the app.config file so it can be changed easily should it need it.
CloudBlobContainer container = new CloudBlobContainer(new Uri(ConfigurationManager.AppSettings["VOURL"]));
//For each of the blobs, write the file name out. This will be needed for a comparison.
foreach (IListBlobItem blobItem in container.ListBlobs())
{
string name = blobItem.Uri.Segments.Last();
Console.WriteLine(name);
}
Console.ReadKey();
}
Run Code Online (Sandbox Code Playgroud)
这是 blob 的结构:
<EnumerationResults ServiceEndpoint="https://test.blob.core.windows.net/" ContainerName="downloads">
<Blobs>
<Blob> …Run Code Online (Sandbox Code Playgroud)