Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7863941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:38:21+00:00 2026-06-02T23:38:21+00:00

The following code returns blob file size of 0: public long GetFileSize(string fileUrl) {

  • 0

The following code returns blob file size of 0:

public long GetFileSize(string fileUrl)
{
    var blob = GetBlobContainer().GetBlobReference(fileUrl);
    return blob == null ? 0 : blob.Properties.Length;
}

, its almost as it does not find the blob. But of I delete the blob I see that it gets deleted. This works when deleting:

void DeleteFileFromBlob(string fileUrl, bool deleteSnapshots)
{
    var blob = GetBlobContainer().GetBlobReference(fileUrl);
    if (deleteSnapshots)
    {
        var options = new BlobRequestOptions { DeleteSnapshotsOption = DeleteSnapshotsOption.IncludeSnapshots };
        blob.DeleteIfExists(options);
    }
    else blob.DeleteIfExists();
}

Its basically the same code as the one above, so it seems that the blob is found.

If I iterate through the blobs I get the correct blob file size, like I do when I calculate the total amount of stored bytes i my storage:

public long GetStorageUsageByteSize()
{
    var blobClient = GetBlobClient();
    return (from container in blobClient.ListContainers()
                      select
                      (from CloudBlob blob in
                           container.ListBlobs(new BlobRequestOptions { UseFlatBlobListing = true })
                       select blob.Properties.Length
                      ).Sum()
                     ).Sum();            
}

So, I cant figure out why the CloubdBlob::Properties.Length returns 0 when I use GetBlobReference with a url.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T23:38:23+00:00Added an answer on June 2, 2026 at 11:38 pm

    It looks like you’re missing a call to the FetchAttributes method, which loads the blob’s metadata:

    blob.FetchAttributes(); 
    

    Reference: https://azure.microsoft.com/en-us/documentation/articles/storage-properties-metadata/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code that returns a .CSV file when a link is
I have the following code snippet: class Cert { public static void main(String[] args)
The following code returns the first location in the string s1 where any character
The following code returns an error Uncaught ReferenceError: size is not defined in Chrome
I have the following code: public ActionResult ViewCategory(string categoryName, string searchCriteria = Price) {
The following code returns me people with similar telephone numbers. It works perfectly but
The following code returns the error from the For Each loop. I have similar
The following code returns an error and I dont know why: require rexml/document include
I the following code returns every text that has the price class associated to
ms-access is connecting to a local mysql database the following code returns an error:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.