如何从 blobtrigger azure 函数 c# 中获取多个文件名

How to get Multiple FIlename from blobtrigger azure function c#

如何使用 blobtrigger azure 函数 c# 从容器中获取多个文件名?

更新:

Sample:

using System;
using System.IO;
using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;
using Microsoft.WindowsAzure.Storage.Blob;

namespace FunctionApp116
{
    public static class Function1
    {
        [FunctionName("Function1")]
        public static void Run([BlobTrigger("test/{name}", Connection = "str")]CloudBlockBlob myBlob,ILogger log)
        {
            string blobname = myBlob.Name;
            string containername = myBlob.Container.Name;
            BlobServiceClient blobServiceClient = new BlobServiceClient(Environment.GetEnvironmentVariable("str"));
            BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient(containername);
            log.LogInformation($"C# Blob trigger function Processed blob\n Name:{blobname}" + $" Container Name is {containername}");
            foreach (BlobItem blobItem in containerClient.GetBlobs())
            {
                log.LogInformation("\t" + blobItem.Name);
            }

        }
    }
}

原答案:

blob trigger可以输入的blob不能超过一个

但是,您可以使用 blob 存储 sdk 从同一个容器中获取多个 blob。

https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-dotnet#code-examples

如果你提供你使用的语言,我可以post一个示例。