If I have a random URL, how would I check if it points to a blob in Azure? If it points to an Azure Blob I can be sure that this blob exists and that I can access it.
I tried the following:
I made some tests with Exists, but it's not very satisfying:
new CloudBlockBlob(new Uri("http://example.com")) ArgumentException: Invalid blob address 'http://example.com/', missing container information new CloudBlockBlob(new Uri("https://example.com/fdh/3746C9A2-533E-4544-A10B-321A8BC40AEA/sample-file.txt")).Exists() false new CloudBlockBlob(new Uri("http://stackoverflow.com/questions/43109843/ways-to-migrate-documents-pdf-forms-from-ms-sharepoint-to-aem")).Exists() StorageException: Blob type of the blob reference doesn't match blob type of the blob.So basically creating the
CloudBlockBlobcan fail,Existscan fail or returnfalse.But it just feels wrong to do it like this.
I could check the url to be
https://<storage-account>.blob.core.windows.net/<container>/*, but I'm not sure if this is always correct.
If I could guarantee that 2. works I would do this because no HTTP request is necessary.
Are there other (better) ways to check if a random URL points to a blob in Azure (maybe something out of the (Azure Storage SDK) box)?