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



The information in this article applies to:

  • Microsoft Collaboration Data Objects for Windows 2000
  • Collaboration Data Objects for Exchange 2000
  • ActiveX Data Objects (ADO) 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("urn:schemas:httpmail:subject") = ""
objMsg.Fields("urn:schemas:mailheader:subject") = ""

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

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

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

Modification Type:MajorLast Reviewed:4/14/2004
Keywords:kbbug KB328056 kbAudDeveloper