Save Method (DataSource)

Topic Last Modified: 2006-06-13

Saves data into the currently bound data source.

Applies To

IDataSource Interface

Type Library

Microsoft CDO for Exchange 2000 Library

DLL Implemented In

CDOEX.DLL

Syntax

Sub Save()
HRESULT Save
();

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

After binding to a data source, such as another object or an item in the Exchange store, call Save to commit changes back to the data source. This method raises the CDO_E_NOT_OPENED exception if there is currently no bound data source. If you bind an object in the Exchange store, you must have opened it explicitly with the adModeReadWrite (3) flag set. If not, you will receive an access denied error (E_ACCESSDENIED).

Changes that must be committed using the Save method include both changes to properties within an object's Fields collection and as changes to an object's stream (where applicable). That is, calling Fields.Update on an object exposing the IDataSource interface does not commit the property changes to the underlying data source.

Invocations of the Save method are not recursive. That is, if you have a chain of open objects, calling Save on one only saves the changes back to object bound to that object. For example, if you use Message object A to open Message object B, and then you use Message object B to open Message object C, calling Save on Message A only commits the changes into Message B.