Compartilhar via


Updating Items in the Exchange Store

Topic Last Modified: 2006-06-12

There are operational differences between Collaboration Data Objects (CDO) and Microsoft® ActiveX® Data Objects (ADO) when you update items in the Exchange store. This section outlines the procedures that are used to update items when using both ADO and CDO.

When you access an item in the Exchange store by using an ADO Record or Recordset object, a copy of the requested properties is copied into the ADO object. If you decide to make changes to the item's properties, you first alter, append or delete the values by using the associated Fields collection, and then save these changes back to the store by using the Fields.Update method. To recopy the values stored in the store back to the ADO object, you use the Fields.Resync method. If the item has an associated stream, you make changes to it by first retrieving it from the Fields collection by using the special ADO index value of -1. The value of this Field is a reference to an ADO Stream object. After modifying the content within the Stream object, you call _Stream.Flush to commit the changes to the store. The important thing to remember is that there is no inherent correlation between the stream and the properties; both are treated as separate data values for the item.

CDO objects that modify items with streams, on the other hand, do maintain a correlation between the stream and the item's properties. Because of this correlation, modifications to the CDO object's Fields collection are not committed directly to the store when the Fields.Update method is called. Instead, you must invoke the Save Method to commit the changes. When the Save Method is executed, the item's stream is re-created and saved to the store along with the property values.