hyzqb 发表于 2017-6-30 18:17:12

如何获取Azure Storage Blob的MD5值

CloudStorageAccount storageAccount = CloudStorageAccount.Parse("<storage connection string>");//storage connection string  CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
  CloudBlobContainer container = blobClient.GetContainerReference("hello");//container name
  foreach (IListBlobItem item in container.ListBlobs(null, false))
  {
  if (item.GetType() == typeof(CloudBlockBlob))
  {
  CloudBlockBlob blob = (CloudBlockBlob)item;
  Console.WriteLine("Block blob of length {0}: {1} + md5:{2}.", blob.Properties.Length, blob.Uri, blob.Properties.ContentMD5);//获取md5值
  }
  else if (item.GetType() == typeof(CloudPageBlob))
  {
  CloudPageBlob pageBlob = (CloudPageBlob)item;
  Console.WriteLine("Page blob of length {0}: {1}", pageBlob.Properties.Length, pageBlob.Uri);
  }
  else if (item.GetType() == typeof(CloudBlobDirectory))
  {
  CloudBlobDirectory directory = (CloudBlobDirectory)item;
  Console.WriteLine("Directory: {0}", directory.Uri);
  }
  }
页: [1]
查看完整版本: 如何获取Azure Storage Blob的MD5值