IOleItemContainer::GetObjectStorage method

Retrieves a pointer to the storage for the specified object.


HRESULT GetObjectStorage(
  [in]  LPOLESTR pszItem,
  [in]  IBindCtx *pbc,
  [in]  REFIID   riid,
  [out] void     **ppvStorage


pszItem [in]

The compound document's name for the object whose storage is requested.

pbc [in]

A pointer to the IBindCtx interface on the bind context to be used in this binding operation. The bind context caches objects bound during the binding process, contains parameters that apply to all operations using the bind context, and provides the means by which the binding implementation should retrieve information about its environment.

riid [in]

A reference to the identifier of the interface to be used to communicate with the object, usually IStorage.

ppvStorage [out]

Address of a pointer variable that receives the interface pointer requested in riid. Upon successful return, *ppvStorage contains the requested interface pointer to the storage for the object named by pszItem. When successful, the implementation must call AddRef on *ppvStorage; it is the caller's responsibility to call Release. If an error occurs, *ppvStorage is set to NULL.

Return value

This method can return the standard return value E_OUTOFMEMORY, as well as the following values.

Return codeDescription

The method completely successfully.


The parameter pszItem does not identify a object in this container.


The object does not have its own independent storage.


The requested interface is not available.



The item moniker implementation of IMoniker::BindToStorage calls this method.

Notes to Implementers

If pszItem designates a pseudo-object, your implementation of IOleItemContainer::GetObjectStorage should return MK_E_NOSTORAGE, because pseudo-objects do not have their own independent storage. If pszItem designates an embedded object, or a portion of the document that has its own storage, your implementation should return the specified interface pointer on the appropriate storage object.


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]






IID_IOleItemContainer is defined as 0000011c-0000-0000-C000-000000000046

See also