# IPersistPropertyBag::Save

Called by the container to save the object’s properties.

HRESULT Save(

IPropertyBag* pPropBag, | //Pointer to the caller’s property bag
BOOL fClearDirty, | //Specifies whether to clear the dirty flag
BOOL fSaveAllProperties | //Specifies whether to save all properties or just those that have changed
); |

Parameters

pPropBag
  [in] Pointer to the caller’s IPropertyBag interface through which the object can write properties. Cannot be NULL.
fClearDirty
  [in] A flag indicating whether the object should clear its dirty flag when saving is complete. TRUE means clear the flag, FALSE means leave the flag unaffected. FALSE is used when the caller wishes to do a Save Copy As type of operation.
fSaveAllProperties
  [in] A flag indicating whether the object should save all its properties (TRUE) or only those that have changed since the last save or initialization (FALSE).

Return Values

S_OK
  The object successfully saved the requested properties itself.
E_FAIL
  There was a problem saving one of the properties. The object can choose to fail only if a necessary property could not be saved, meaning that the object can assume default property values if a given property is not seen through IPersistPropertyBag::Load at some later time.
E_POINTER
  The address in pPropBag is not valid (such as NULL) and therefore the object cannot initialize itself.
STG_E_MEDIUMFULL
  The object was not saved because of a lack of space on the disk.

Remarks

This method instructs the object to save its properties to the specified property bag, optionally clearing the object’s dirty flag. The caller can request that the object save all properties or that the object save only those that are known to have changed.

E_NOTIMPL is not a valid return code as any object implementing this interface must support the entire functionality of the interface.

See Also

IPersistPropertyBag::InitNew, IPersistPropertyBag::Load