BUG: urn:schemas:mailheader:from Field Is Corrupted When Binding to an ADO Stream (256517)
The information in this article applies to:
- ActiveX Data Objects (ADO) 2.6
- Collaboration Data Objects for Exchange 2000
- Microsoft Collaboration Data Objects for Windows 2000
This article was previously published under Q256517 SYMPTOMS
When you bind to an ASCII file using an ActiveX Data Objects (ADO) Stream object, the field name urn:schemas:mailheader:from may be corrupted.
CAUSE
By default, the ADO Stream object uses the Unicode character set. Because the data in the newsgroup post (.nws) is ASCII, the field name becomes corrupted due to the mismatched character sets. ADO adds the Unicode byte-order marks to the beginning of any ASCII file, which creates a custom header as shown below.
Standard Header:
urn:schemas:mailheader:from
Modified Header:
urn:schemas:mailheader:from
WORKAROUND
To work around this problem, specify that the stream contains ASCII text before loading the file:
Sub main()
Dim oMsg As New CDO.Message
Dim oStream As New ADODB.Stream
Dim oField As ADODB.Field
Dim i As Integer
Dim sFilepath As String
sFilepath = "\\servername\directory\test.nws"
'Note: The line below is the only change to the code in the "More Information" section.
oStream.Charset = "us-ascii"
oStream.Open
oStream.LoadFromFile sFilepath
oStream.Flush
oMsg.BodyPart.DataSource.OpenObject oStream, cdoAdoStream
'Print all of the fields.
i = 0
For Each oField In oMsg.Fields
Debug.Print i & ") " & oField.Name & " = " & oField.Value
i = i + 1
Next
'Query for the "From" Field.
For Each oField In oMsg.Fields
If (oField.Name = "urn:schemas:mailheader:from") Then
Debug.Print oField.Name & " = " & oField.Value
End If
Next
End Sub
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 8/25/2005 |
---|
Keywords: | kbbug kbnofix KB256517 |
---|
|