WebGetStorageQuota Function  
 
BOOL WINAPI WebGetStorageQuota(
  LPWEB_STORAGE_QUOTA lpQuota  
);

The WebGetStorageQuota function returns quota limits assigned to your storage account.

Parameters

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

Return Value

If the function succeeds, the return value is a non-zero. If the function fails, the return value is zero. To get extended error information, call WebGetLastError.

Remarks

The WebGetStorageQuota function 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

WEB_STORAGE_QUOTA appQuota;

// Initialize the library
if (WebInitialize(CSTOOLS11_LICENSE_KEY, NULL) == FALSE)
{
    _tprintf(_T("Unable to initialize the SocketTools library\n"));
    return;
}

// Display storage account usage and limits
if (WebGetStorageQuota(&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
    TCHAR szError[128];

    WebGetErrorString(WebGetLastError(), szError, 128);    
    _tprintf(_T("Unable to get the account quota (%s)\n"), szError);
}				

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools11.h
Import Library: cswebv11.lib

See Also

WebGetObjectInformation, WebGetObjectSize, WEB_STORAGE_QUOTA