Microsoft KB Archive/328056

= BUG: Related headers do not stay in sync when you programmatically set a header field to an empty string =

Article ID: 328056

Article Last Modified on 4/14/2004

-

APPLIES TO


 * Microsoft Collaboration Data Objects 2.0
 * Collaboration Data Objects for Exchange 2000
 * Microsoft ActiveX Data Objects 2.5

-



This article was previously published under Q328056



SYMPTOMS
When you programmatically set a header field to an empty string, the related header does not stay in sync. The initial value is still displayed when you run the query.



CAUSE
This problem occurs because when you set the interface property to an empty string, the related header is deleted. ActiveX Data Objects (ADO) looks for the field because it existed previously. Collaboration Data Objects (CDO) returns the DBSTATUS_E_DOESNOTEXIST status code for the field. ADO sets the status of the fields to adFieldDoesNotExist, but it does not update the values.



WORKAROUND
To work around this problem, explicitly set the header field to an empty string. For example, you can use the following code sample: objMsg.Fields(&quot;urn:schemas:httpmail:subject&quot;) = &quot;&quot; objMsg.Fields(&quot;urn:schemas:mailheader:subject&quot;) = &quot;&quot;



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section.



MORE INFORMATION
The following code sample illustrates this problem: Dim objMsg As New CDO.Message objMsg.Subject = &quot;test subject&quot; Debug.Print objMsg.Fields(&quot;urn:schemas:httpmail:subject&quot;)  'Output: &quot;test subject&quot; Debug.Print objMsg.Fields(&quot;urn:schemas:mailheader:subject&quot;) 'Output: &quot;test subject&quot; objMsg.Subject = &quot;&quot; objMsg.Fields.Resync

Debug.Print objMsg.Fields(&quot;urn:schemas:httpmail:subject&quot;)  'Output: &quot;test subject&quot; Debug.Print objMsg.Fields(&quot;urn:schemas:mailheader:subject&quot;) 'Output: &quot;test subject&quot;

