# IPropertySetStorage::Open

Opens a property set contained in the property set storage object.

HRESULT Open(

REFFMTID fmtid, | //The format identifier of the property set to be opened
DWORD grfMode, | //Storage mode in which property set is to be opened
IPropertyStorage** ppPropStg | //Indirect pointer to property storage object
); |

Parameters

fmtid
  [in] Format identifier of the property set to be opened.
grfMode
  [in] Access mode in which the newly created property set is to be opened. These flags are taken from the STGM enumeration. Flags that may be used and their meanings in the context of this method are described in the Remarks.
ppPropStg
  [in] Indirect pointer to the IPropertyStorage interface on the requested property storage sub-object.

Return Values

This method supports the standard return value E_UNEXPECTED, as well as the following:

S_OK
  Success.
STG_E_FILENOTFOUND
  A property set of the indicated name does not exist.
STG_E_ACCESSDENIED
  The requested access to the property storage object has been denied, or the property set is corrupted.
STG_E_INSUFFICIENTMEMORY
  There is not sufficient memory to perform this operation.
STG_E_INVALIDPARAMETER
  A parameter is invalid.

Remarks

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

Value | Meaning
STGM_DIRECT | Open 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_TRANSACTED | Open 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 on non-simple property sets, because they use an IStorage with a contents stream. 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_READ | Open the property set with read access. Read permission is required on the property set storage.
STGM_WRITE | Open the property set with write access. Write permission is not required on the IPropertySetStorage; however, such write permission is required for changes in the storage to be committed.
STGM_READWRITE | Open the property set with read-write access. Note that this flag is not the binary OR of the values STGM_READ and STGM_WRITE.
STGM_SHARE_DENY_NONE | Subsequent openings of the property set are not denied read or write access. Not available in compound file implementation.
STGM_SHARE_DENY_READ | Subsequent openings of the property set in are denied read access. Not available in compound file implementation.
STGM_SHARE_DENY_WRITE | Subsequent openings of the property set are denied write access. This value is typically used to prevent making unnecessary copies of an object opened by multiple users. If 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 compound file implementation.
STGM_SHARE_EXCLUSIVE | The combination of STGM_SHARE_DENY_READ and STGM_SHARE_DENY_WRITE.