Windows Azure StorageのBlobの存在チェックの方法
Windows Azure StorageのBlobの存在チェックの方法
φ(..)メモメモ
FetchAttributes()を実行し、Exceptionをcatchして、StorageErrorCode.BlobNotFoundで判定すればいいっぽい。
CloudBlob blob = Container.GetBlobReference(name); try { blob.FetchAttributes(); } catch (StorageClientException e) { // Someone may have deleted the blob in the meantime if (e.ErrorCode == StorageErrorCode.BlobNotFound) { ・・・・
との事なんだが・・・試してみると「StorageErrorCode.BlobNotFound」じゃなくて「StorageErrorCode.ResourceNotFound」になってるなぁ・・・
まぁ、こんな感じで出来そう。