AzureBlobStorage连接器-CreateFile/DeleteFile-ID,与.NET的Azure存储Blobs客户端库的关系 [英] AzureBlobStorage Connector - CreateFile/DeleteFile - Id, relationship with Azure Storage Blobs client library for .NET

查看:121
本文介绍了AzureBlobStorage连接器-CreateFile/DeleteFile-ID,与.NET的Azure存储Blobs客户端库的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 AzureBlobStorage连接器(连接器)的powerapp.但是,此应用必须与使用

I have a powerapp using the AzureBlobStorage Connector(the connector) . However, this app has to interact with data that is being bulk uploaded using the Azure Storage Blobs client library for .NET (the api).

使用连接器创建Blob时,您将获得ID和ID,然后可使用该ID删除Blob.

When you create a blob using the connector you get and Id which can then be used to Delete the blob.

但是,当使用 api 创建blob时,我看不到如何获取该ID(您只是使用文件名blobid).因此,无法在Power App中删除正在批量创建的数据.

However, when creating blobs with the api I cannot see how I can get that ID (you just use the blobid which is the filename). Hence data that is being bulk created cannot be deleted in the Power App.

连接器返回 BlobMetadata CreateFile 的对象.

The connector returns a BlobMetadata object when calling CreateFile.

API 返回 UploadBlob .此元数据对象不包含ID或与BlobMetadata.ID格式匹配的任何内容.

The api returns a BlobContentInfo when calling UploadBlob. This metadata object does not contain an Id or anything matching the format of the BlobMetadata.ID.

有人知道我如何从 API 获取此ID?

Does anyone know how I can get this Id from the API?

推荐答案

您可以从文档有关使用.Net设置和检索元数据的信息.

You could get Blob metadata from BlobProperties.Metadata. This is the document about setting and retrieving metadata using .Net.

// Get a reference to a container named "sample-container" and then create it
BlobContainerClient container = new BlobContainerClient(connectionString, containerName);

// Get a reference to a blob named "sample-file" in a container named "sample-container"
BlobClient blob = container.GetBlobClient(blobName);
await ReadBlobMetadataAsync(blob);

// Retrieve metadata
public static async Task ReadBlobMetadataAsync(BlobClient blob)
{
    try
    {
        // Get the blob's properties and metadata.
        BlobProperties properties = await blob.GetPropertiesAsync();

        Console.WriteLine(properties.BlobType);
        Console.WriteLine("Blob metadata:");
        

        // Enumerate the blob's metadata.
        foreach (var metadataItem in properties.Metadata)
        {
            Console.WriteLine($"\tKey: {metadataItem.Key}");
            Console.WriteLine($"\tValue: {metadataItem.Value}");
        }
    }
    catch (RequestFailedException e)
    {
        Console.WriteLine($"HTTP error code {e.Status}: {e.ErrorCode}");
        Console.WriteLine(e.Message);
        Console.ReadLine();
    }
}

您还可以使用Azure-CLI获取元数据,请参见此处.

You could also get metadata using Azure-CLI, see here.

这篇关于AzureBlobStorage连接器-CreateFile/DeleteFile-ID,与.NET的Azure存储Blobs客户端库的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆