AvailableFreeSpace Property
Collapse the table of content
Expand the table of content

IsolatedStorageFile.AvailableFreeSpace Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets a value that represents the amount of free space available for isolated storage.

Namespace:  System.IO.IsolatedStorage
Assembly:  mscorlib (in mscorlib.dll)

public long AvailableFreeSpace { get; }

Property Value

Type: System.Int64
The available free isolated storage space, in bytes.


The isolated store has been removed.


Isolated storage is disabled.


The isolated store has been disposed.

This property obtains the value from the store's associated quota group. Because the quota could change, the value cannot be cached in memory and must be read directly from the disk each time.

The following example checks the available free space to determine whether to increase the quota size. This example is part of a larger example provided for IsolatedStorageFile class.

// Assumes an event handler for the MouseLeftbuttonUp
// event is defined for a control named 'IncreaseQuota'
// In the control's XAML: MouseLeftButtonUp="IncreaseQuota_OnLeftMouseButtonUp"

// User first selects UI to increase the quota.
public void IncreaseQuota_OnClick(object sender, MouseEventArgs e)

    // Obtain an isolated store for an application.
        using (var store = IsolatedStorageFile.GetUserStoreForApplication())
            // Request 5MB more space in bytes.
            Int64 spaceToAdd = 5242880;
            Int64 curAvail = store.AvailableFreeSpace;

            // If available space is less than
            // what is requested, try to increase.
            if (curAvail < spaceToAdd)

                // Request more quota space.
                if (!store.IncreaseQuotaTo(store.Quota + spaceToAdd))
                    // The user clicked NO to the
                    // host's prompt to approve the quota increase.
                    // The user clicked YES to the
                    // host's prompt to approve the quota increase.

    catch (IsolatedStorageException)
        // TODO: Handle that store could not be accessed.


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2017 Microsoft