IPropertySetStorage::Open method

The Open method opens a property set contained in the property set storage object.


  [in]  REFFMTID         fmtid,
  [in]  DWORD            grfMode,
  [out] IPropertyStorage **ppPropStg


fmtid [in]

The format identifier (FMTID) of the property set to be opened. For more information about well-known and predefined FMTIDs in the Platform SDK, see Predefined Property Set Format Identifiers.

grfMode [in]

The access mode in which the newly created property set is to be opened. These flags are taken from STGM Constants. Flags that may be used and their meanings in the context of this method are described in the following Remarks section.

ppPropStg [out]

A pointer to the IPropertyStorage pointer variable that receives the interface pointer to the requested property storage subobject.

Return value

This method supports the standard return value E_UNEXPECTED, in addition to the following:




A property set of the indicated name does not exist.


The requested access to the property storage object has been denied, or the property set is corrupted.


There is not enough memory to perform this operation.


The specified combination of grfMode flags is not supported.


The storage object has been invalidated by a revert operation above it in the transaction tree.


A parameter is not valid.


The mode in which the property set is to be opened is specified in the parameter grfMode. These flags are taken from STGM Constants, but, for this method, legal values and their meanings are as follows (only certain combinations of these flag values are legal).

STGM_DIRECTOpens the property set without an additional level of transaction nesting. This is the default (the behavior if neither STGM_DIRECT nor STGM_TRANSACTED is specified).
STGM_TRANSACTEDOpens the property set with an additional level of transaction nesting (beyond the transaction, if any, on this property set storage object). Transacted mode is available only for nonsimple property sets. Changes in the property set must be committed with a call to IPropertyStorage::Commit before they are visible to the transaction on this property set storage.
STGM_READOpens the property set with read access. Read permission is required on the property set storage.
STGM_WRITEOpens the property set with write access. Not all implementations of IPropertyStorage support this mode.
STGM_READWRITEOpens the property set with read and write access. Be aware that this flag is not the binary OR of the values STGM_READ and STGM_WRITE.
STGM_SHARE_DENY_NONESubsequent openings of the property set from this property set storage are not denied read or write access. (Not available in all implementations.)
STGM_SHARE_DENY_READSubsequent openings of the property set from this property set storage are denied read access. Not available in all implementations.
STGM_SHARE_DENY_WRITESubsequent openings of the property set from this property set storage are denied write access. This value is typically used in the transacted mode to prevent making unnecessary copies of an object opened by multiple users. That is, if STGM_TRANSACTED is specified, but this value is not specified, a snapshot is made, whether there are subsequent openings or not. Thus, you can improve performance by specifying this value. Not available in all implementations.
STGM_SHARE_EXCLUSIVESubsequent openings of the property set from this property set storage are not possible. Be aware that this value is not a simple binary OR of the STGM_SHARE_DENY_READ and STGM_SHARE_DENY_WRITE elements.


This method is subject to the constraints of the underlying IStorage::OpenStream (for simple property sets) or IStorage::OpenStorage (for nonsimple property sets). For more information about simple and nonsimple property sets, see Storage and Stream Objects for a Property Set. For example, when using the IPropertySetStorage-Compound File Implementation, you must specify STGM_SHARE_EXCLUSIVE in the grfMode parameter to IPropertySetStorage::Open. Conversely, if using the IPropertySetStorage-Stand-alone Implementation, IPropertySetStorage::Open is subject to constraints that apply to the caller-specified IStorage.


Minimum supported client

Windows 2000 Professional [desktop apps | UWP apps]

Minimum supported server

Windows 2000 Server [desktop apps | UWP apps]


Propidl.h (include Objbase.h)






IID_IPropertySetStorage is defined as 0000013A-0000-0000-C000-000000000046

See also

EnumAll Sample
WriteRead Sample