簡體   English   中英

嘗試刪除Azure Functions中的Blob但缺少DeleteIfExists方法

[英]Trying to delete a blob in Azure Functions but DeleteIfExists method is missing

我使用BlobTrigger模板使用blob觸發器創建了一個新的C#Azure函數。 然后,我將blob觸發器綁定的類型更改為CloudBlockBlob。 接下來,我嘗試添加一行以刪除Blob。 導致的結果是函數編譯錯誤:

[Error] run.csx(8,12): error CS1061: 'CloudBlockBlob' does not contain a definition for 'DeleteIfExists' and no extension method 'DeleteIfExists' accepting a first argument of type 'CloudBlockBlob' could be found (are you missing a using directive or an assembly reference?)

我想念什么? 根據文檔,CloudBlockBlob應該具有一個名為DeleteIfExists的方法。

這是我的整個功能:

#r "Microsoft.WindowsAzure.Storage"

using Microsoft.WindowsAzure.Storage.Blob;

public static void Run(CloudBlockBlob myBlob, string name, ILogger log)
{
    log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Properties.Length} Bytes");
    myBlob.DeleteIfExists();
}

如果使用Function v2,則可能使用的是.NET Core或.NET Standard,它們似乎僅支持異步方法。 使用await myblob.DeleteIfExistsAsync()代替。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM