如何添加和检索 Azure Blob 的其他信息

Gyö*_*yás 0 .net c# blob azure azure-storage

有没有办法在 Azure 中为 blob 添加其他信息?

我想存储一些相关信息,这些信息将 blob 连接到文档数据库中的其他实体,例如包含 JSON 的字符串。

我知道在使用 Azure 存储资源管理器时有 blob 的元数据,但我想从代码中使用它。

这是关于此主题的相关问题: 将描述/元数据添加到 Azure Blob

以及如何根据此元数据检索 blob?

Mih*_*scu 5

你检查过这个链接吗?

public static async Task AddContainerMetadataAsync(CloudBlobContainer container)
{
   // Add some metadata to the container.
   container.Metadata.Add("docType", "textDocuments");
   container.Metadata["category"] = "guidance";

   // Set the container's metadata.
   await container.SetMetadataAsync();
}
Run Code Online (Sandbox Code Playgroud)

请记住

元数据的名称必须符合 C# 标识符的命名约定。