Quota Property
Collapse the table of content
Expand the table of content

IsolatedStorageFile.Quota 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 maximum amount of space available for isolated storage.

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

'Declaration
Public ReadOnly Property Quota As Long

Property Value

Type: System.Int64
The limit of isolated storage space, in bytes.

ExceptionCondition
IsolatedStorageException

The isolated store has been removed.

-or-

Isolated storage is disabled.

ObjectDisposedException

The isolated store has been disposed.

This property obtains the value from the store's associated quota group. The initial quota is 1 MB to be shared by all of the domain's applications.

Use the AvailableFreeSpace property to determine whether you need to increase the quota by using the IncreaseQuotaTo method.

The following example checks 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"
Public Sub IncreaseQuota_OnClick(ByVal sender As Object, ByVal e As MouseEventArgs)
    ' Obtain an isolated store for an application.
    Try
        Using store As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()
            ' Request 5MB more space in bytes.
            Dim spaceToAdd As Int64 = 5242880
            Dim curAvail As Int64 = store.AvailableFreeSpace
            ' If available space is less than
            ' what is requested, try to increase.
            If (curAvail < spaceToAdd) Then
                ' Request more quota space.
                If Not store.IncreaseQuotaTo((store.Quota + spaceToAdd)) Then
                    ' The user clicked NO to the
                    ' host's prompt to approve the quota increase.
                Else
                    ' The user clicked YES to the
                    ' host's prompt to approve the quota increase.
                End If
            End If
        End Using
    Catch Ex As IsolatedStorageException

        ' TODO: Handle that store could not be accessed.
    End Try
End Sub


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft