CWebStorage::GetStorageQuota Method  
 
BOOL GetStorageQuota(
  LPWEB_STORAGE_QUOTA lpQuota  
);

The GetStorageQuota method returns quota limits assigned to your development account.

Parameters

lpQuota
A pointer to a WEB_STORAGE_QUOTA structure that will contain information the quota limits for your account when the method returns. This parameter cannot be NULL.

Return Value

If the method succeeds, the return value is non-zero. If the method fails, the return value is zero. To get extended error information, call the GetLastError method.

Remarks

The GetStorageQuota method can be used to determine how much storage space is available to your application. The ulBytesFree structure member will tell you how many bytes of storage you have available, and the dwObjectSize member will tell you the maximum size of any individual storage object. In addition to the bytes allocated for storage, there is also a limit on the total number of objects that your application may create which is specified by the dwObjectLimit member.

Accounts that are created with an evaluation license have much lower quota limits than a standard account and should be used for testing purposes only. After the evaluation period has ended, all objects stored using the evaluation license will be deleted.

Example

CWebStorage appStorage;
WEB_STORAGE_QUOTA appQuota;

// Display storage account usage and limits
if (appStorage.GetStorageQuota(&appQuota))
{
     _tprintf(_T("Objects Used:  %lu\n"), appQuota.dwObjects);
     _tprintf(_T("Object Limit:  %lu\n"), appQuota.dwObjectLimit);
     _tprintf(_T("Object Size:   %lu\n"), appQuota.dwObjectSize);
     _tprintf(_T("Bytes Used:    %I64u\n"), appQuota.ulBytesUsed);
     _tprintf(_T("Bytes Free:    %I64u\n"), appQuota.ulBytesFree);
     _tprintf(_T("Storage Limit: %I64u\n"), appQuota.ulStorageLimit);
}
else
{
    // Unable to get the quota information for this account
    CString strError;

    appStorage.GetErrorString(strError);    
    _tprintf(_T("Unable to get the account quota (%s)\n"), (LPCTSTR)strError);
}				

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: cswebv12.lib
Unicode: Implemented as Unicode and ANSI versions

See Also