Getting quota information for a Title Storage service configuration

This topic demonstrates how to get quota information for a specified service configuration and storage type in Xbox Title Storage by using the following flat C code example.

Note

For TrustedPlatform storage types, the request is made for the calling player's Xbox user ID.

Flat C

auto asyncBlock = std::make_unique<XAsyncBlock>();
asyncBlock->queue = queue;
asyncBlock->context = nullptr;
asyncBlock->callback = [](XAsyncBlock* asyncBlock)
{
    std::unique_ptr<XAsyncBlock> asyncBlockPtr{ asyncBlock };   // Take over ownership of XAsyncBlock*.
    size_t usedBytes;
    size_t quotaBytes;
    HRESULT hr = XblTitleStorageGetQuotaResult(asyncBlock, &usedBytes, &quotaBytes);
};

HRESULT hr = XblTitleStorageGetQuotaAsync(
    xboxLiveContext,
    scid,
    storageType,
    asyncBlock.get()
);

if (SUCCEEDED(hr))
{
    // The call succeeded, so release  std::unique_ptr ownership of XAsyncBlock* because
    // the callback takes over ownership. If the call fails, however, std::unique_ptr keeps
    // ownership and deletes XAsyncBlock*.
    asyncBlock.release();
}

See also

XAsyncBlock

XblTitleStorageGetQuotaAsync

XblTitleStorageGetQuotaResult