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