The WebGetObjectSize function is used to retrieve the
size of a stored object on the server. This function can also be used as
a simple method to determine if the specified object exists. An object
size of zero means the object exists, but currently has no data associated
with it.
If the lpObjectSize parameter is not NULL, its value is
initialized to zero when the function is called, and updated with the
object size when the function returns.
Although storage object labels are similar to Windows file names,
they are case-sensitive. When requesting the size of an object, your
application must specify the label name exactly as it was created. The
object label cannot contain wildcard characters.
The WebGetObjectInformation function can be used
to obtain the metadata associated with the storage object, including
the size, content type, creation date and a SHA-256 digest of the data.
To obtain information about how much storage your applications are
using and the total number of stored objects, use the
WebGetStorageQuota function.
DWORD dwObjectSize;
if (WebGetObjectSize(hStorage, lpszObjectLabel, &dwObjectSize))
{
_tprintf(_T("The size of \"%s\" is %lu bytes\n"), lpszObjectLabel, dwObjectSize);
}
else
{
TCHAR szError[128];
WebGetErrorString(WebGetLastError(), szError, 128);
_tprintf(_T("Unable to get the size of \"%s\" (%s)\n"), lpszObjectLabel, szError);
}