# IPropertySetStorage-Compound File Implementation

The OLE compound file storage object implementation includes an implementation of both IPropertyStorage, the interface that manages a single persistent property set, and IPropertySetStorage, the interface that manages groups of persistent property sets.

To get a pointer to the compound file implementation of IPropertySetStorage, first call StgCreateDocfile to create a new compound file object or StgOpenStorage to open a previously created compound file. Both functions supply a pointer to the object’s IStorage interface. When you want to deal with persistent property sets, call IStorage::QueryInterface for the IPropertySetStorage interface, specifying the header-defined name for the interface identifier IID_IPropertySetStorage.

##### When to Use

Call the methods of IPropertySetStorage to create, open, or delete property sets in the current compound file property set storage. There is also a method that supplies a pointer to an enumerator that can be used to enumerate the property sets in the storage.

Remarks

IPropertySetStorage::Create
  Creates a new property set in the current compound file storage and, on return, supplies an indirect pointer to the IPropertyStorage compound file implementation. In this implementation, property sets may be transacted only if PROPSETFLAG_NONSIMPLE is specified.
IPropertySetStorage::Open
  Opens an existing property set in the current property storage. On return, it supplies an indirect pointer to the compound file implementation of IPropertyStorage.
IPropertySetStorage::Delete
  Deletes a property set in this property storage.
IPropertySetStorage::Enum
  Creates an object that can be used to enumerate STATPROPSETSTG structures. Each STATPROPSETSTG structure provides information about a single property set. The implementation calls the constructor for IEnumSTATPROPSETSTG, which, in turn, uses the pointer to the IStorage interface to create a STATSTG enumerator, which is then used over the actual storage to get the information about the property sets.

Note The DocumentSummaryInformation property set is special, in that it may have two property set sections. This property set is described in the OLE Programmer’s Reference, in the section titled The DocumentSummaryInformation Property Set. The second section is referred to as the User-Defined Properties. Each section is identified with a unique Format ID, for example FMTID_DocumentSummaryInformation and FMTID_UserDefinedProperties.

When IPropertySetStorage::Create is called to create the User-Defined Property Set, the first section is created automatically. Thus once FMTID_UserDefinedProperties is created, FMTID_DocumentSummaryInformation need not be created, but can be opened with a call to IPropertySetStorage::Open. Note that creating the first section does not automatically create the second section. It is not possible to open both sections simultaneously.

When IPropertySetStorage::Create is called to create the User-Defined Property Set, the first section is created automatically. Thus once FMTID_UserDefinedProperties is created, FMTID_DocumentSummaryInformation need not be created, but can be opened with a call to IPropertySetStorage::Open. Note that creating the first section does not automatically create the second section. It is not possible to open both sections simultaneously.

Alternately, when IPropertySetStorage::Delete is called to delete the first section, both sections are deleted. That is, calling IPropertySetStorage::Delete with FMTID_DocumentSummaryInformation, causes both that section and the FMTID_UserDefinedProperties section to be deleted. Note that deleting the second section does not automatically delete the first section.

Finally, when IPropertySetStorage::Enum is used to enumerate property sets, the User-Defined Property Set will not be enumerated.

See Also

IPropertyStorage, IPropertySetStorage - Compound File Implementation, STATPROPSETSTG structure, PROPSETFLAG enumeration, IStorage::EnumElements