CWebStorage::GetObjectInformation Method  
 
BOOL GetObjectInformation(
  LPCTSTR lpszObjectLabel,  
  LPWEB_STORAGE_OBJECT lpObject  
);

The GetObjectInformation method retrieves the metadata for a storage object.

Parameters

lpszObjectLabel
A null-terminated string that specifies the label of the storage object.
lpObject
A pointer to a WEB_STORAGE_OBJECT structure that will contain additional information about the object. This parameter cannot be a NULL pointer.

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 GetLastError.

Remarks

The GetObjectInformation method is used to retrieve the metadata for a stored object on the server, such as the date and time the object was created, the content type and the SHA-256 hash of the object contents. This method can also be used as a simple method to determine if the specified object exists without the overhead of requesting the server attempt to retrieve the contents of an object.

Although storage object labels are similar to Windows file names, they are case-sensitive. When requesting information about an object, your application must specify the label name exactly as it was created. The object label cannot contain wildcard characters.

If you are only interested in obtaining the size of a stored object, you can use the GetObjectSize method.

To obtain information about how much storage your applications are using and the total number of stored objects, use the GetStorageQuota method.

Example

WEB_STORAGE_OBJECT webObject;

// Get information about the object
if (pStorage->GetObjectInformation(lpszObjectLabel, &webObject))
{
    // The object exists, display the metadata
    _tprintf(_T("Object:  %s\n"), webObject.szObjectId);
    _tprintf(_T("Label:   %s\n"), webObject.szLabel);
    _tprintf(_T("Size:    %lu\n"), webObject.dwObjectSize);
    _tprintf(_T("Digest:  %s\n"), webObject.szDigest);
    _tprintf(_T("Content: %s\n"), webObject.szContent);
}
else
{
    // The object does not exist, display the error
    CString strError;

    pStorage->GetLastError(strError);    
    _tprintf(_T("Unable to get information on \"%s\" (%s)\n"), lpszObjectLabel, (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