Posts Getting the Free Storage Space in WinRT

Getting the Free Storage Space in WinRT

I didnt find any documenation to this method other than the thread in StackOverflow:

so im keeping it here so it wont get lost by the winds of time….

public static async Task<UInt64> GetFreeSpace(this IStorageItem sf)
    var properties = await sf.GetBasicPropertiesAsync();
    var filteredProperties = await properties.RetrievePropertiesAsync(new[] { "System.FreeSpace" });
    var freeSpace = filteredProperties["System.FreeSpace"];
    return (UInt64)freeSpace;

Sample use:

var freeSpace = await ApplicationData.Current.LocalFolder.GetFreeSpace();

Thank you  Filip Skakun

This post is licensed under CC BY 4.0 by Tamir Dresher.

Trending Tags