I would like to get the URL for a BlobItem
.
In the Azure Portal, I can see the URL in the properties section, but when I get the BlobItemProperties
object from the BlobItem
, I cannot find the URL
property.
Here is what I have so far:
var blobContainerClient = new BlobContainerClient(connectionString, containerName);
await foreach (var blob in blobContainerClient.GetBlobsAsync())
{
blob.Properties.???
}
One way to find the URL of the blob is by using the Azure portal by going to Home > Storage Account > Container > Blob > Properties. However, probably the easiest way is to find the blob in the Storage Explorer, right-click, then select 'Copy URL'. This will copy the resource URL directly to the clipboard.
By default, the URL for accessing the Blob service in a storage account is https://<your account name>. blob.core.windows.net.
Definition. The BlobUriBuilder class provides a convenient way to modify the contents of a Uri instance to point to different Azure Storage resources like an account, container, or blob. For more information, see Naming and Referencing Containers, Blobs, and Metadata.
Function that code blob object from some stream URL works one-way. Blobs are created and are valid only during browser is open and are stored in browser memory. The only possible solution is to check what javascript is executed on page load and find something like ` = new Blob () `
In order to create a client given the full URI to the blob, use the from_blob_url classmethod. The container name for the blob. The name of the blob with which to interact. If specified, this value will override a blob value specified in the blob URL.
The timeout parameter is expressed in seconds. Create BlobClient from a blob url. This doesn't support customized blob url with '/' in blob name. The full endpoint URL to the Blob, including SAS token and snapshot if used. This could be either the primary endpoint, or the secondary endpoint depending on the current location_mode.
The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. Creates a new Append Blob. Creates a new Page Blob of the specified size. Creates a snapshot of the blob. A snapshot is a read-only version of a blob that's taken at a point in time. It can be read, copied, or deleted, but not modified.
There is no AbsoluteUri or Uri property available with the latest SDK , what you need to actually do is to generate a url based on the Container Uri.
You can get the Container Uri as,
var containerUri = blobContainerClient.Uri.AbsoluteUri;
and then you can generate as
List<string> results = new List<string>();
await foreach (BlobItem blobItem in containerClient.GetBlobsAsync())
{
results.Add(
Flurl.Url.Combine(
containerClient.Uri.AbsoluteUri,
blobItem.Name
)
);
}
Also make sure to import,
using Flurl;
You can do that :
var blobContainerClient = new BlobContainerClient(connectionString, containerName);
await foreach (var blob in blobContainerClient.GetBlobsAsync())
{
BlobClient blobClient = blobContainerClient.GetBlobClient(blob.Name);
var uri = blobClient.Uri;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With