Getting the Free Storage Space in WinRT

Tuesday, December 16, 2014

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; return (UInt64)freeSpace; } Sample use: var freeSpace = await ApplicationData.Current.LocalFolder.GetFreeSpace(); Debug.WriteLine(freeSpace.GetSizeString()); Thank you  Filip Skakun
no comments