The IPersistPropertyBag2 interface works in conjunction with the IPropertyBag2 and IErrorLog interfaces to define an individual property-based persistence mechanism.
IPersistPropertyBag2 Methods
InitNew Informs the object that it is being initialized as a newly created object. IsDirty Indicates if one or more properties have changed since the last initialization or save operation. Load Instructs the object to initialize itself using the properties available in the property bag, notifying the provided error log object when errors occur. Save Instructs the object to save its properties to the given property bag, optionally clearing the object's "dirty" flag.
Interface Information
Implementation Custom Inherits from IPersist Header and IDL files Ocidl.h; Ocidl.idl Minimum availability Internet Explorer 4.0 Minimum operating systems Windows 95, Windows NT 4.0
Remarks
The IPersistPropertyBag2 interface is similar to IPersistPropertyBag, but it allows the object to support property bags that implement IPropertyBag2.
Where a mechanism such as IPersistStream gives an object an IStream in which to store its binary data, IPersistPropertyBag2 provides an object with an IPropertyBag2 interface through which it can save and load individual properties. The object that implements IPropertyBag2 can then save those properties in various ways, such as name/value pairs in a text file. Errors encountered in the process (on either side) are recorded in an error log through IErrorLog. This error reporting mechanism works on a per-property basis instead of on all properties at once.
When requesting a persistent property bag interface, a property bag that supports IPropertyBag2 will attempt to obtain the object's IPersistPropertyBag2 interface before attempting to obtain the object's IPersistPropertyBag interface. This allows objects that support either interface to communicate with the property bag.