Dotnet Tutorials ,Codings & Examples: How to Check Azure Blob List Exist or Not <h1 class='display-2'> How to Check Azure Blob List Exist or Not ~ Dotnet Tutorials ,Codings & Examples</h1>

How to Check Azure Blob List Exist or Not

Check Blob List Exist or Not

use the following snippet to check whether the blob is Exist or not
   
public  static  bool  Exists(this  CloudBlob  blob)
         {
             try 
             {
                 blob.FetchAttributes();
                 return  true ;
             }
             catch  (StorageClientException  e)
             {
                 if  (e.ErrorCode == StorageErrorCode .ResourceNotFound)
                 {
                     return  false ;
                 }
                 else 
                 {
                     throw ;
                 }
             }
         }
 

0 comments :

Post a Comment