Partager via


MimeHeaderReader.TryGetValue Method (DecodingOptions, DecodingResults, String)

The TryGetValue method tries to get the value of the current header and put it in value.

Namespace:  Microsoft.Exchange.Data.Mime
Assembly:  Microsoft.Exchange.Data.Common (in Microsoft.Exchange.Data.Common.dll)

Syntax

'Declaration
Public Function TryGetValue ( _
    decodingOptions As DecodingOptions, _
    <OutAttribute> ByRef decodingResults As DecodingResults, _
    <OutAttribute> ByRef value As String _
) As Boolean
'Usage
Dim instance As MimeHeaderReader
Dim decodingOptions As DecodingOptions
Dim decodingResults As DecodingResults
Dim value As String
Dim returnValue As Boolean

returnValue = instance.TryGetValue(decodingOptions, _
    decodingResults, value)
public bool TryGetValue(
    DecodingOptions decodingOptions,
    out DecodingResults decodingResults,
    out string value
)

Parameters

Return Value

Type: System.Boolean
The TryGetValue method returns true if it was able to decode the header. It returns false, and sets value to a null reference (Nothing in Visual Basic), if it was unable to decode the header.

Remarks

If None is specified, the TryGetValue method treats the display name as ASCII and converts it to Unicode. Otherwise, TryGetValue tries to determine the character set used by applying the following criteria in the order listed:

  • The character set that is defined by RFC 2047.

  • The character set that is defined by the charset parameter of the Content-Type header.

  • The character set that is defined by the decodingOptions parameter that is passed to TryGetValue.

If null was passed for the decodingOptions parameter, TryGetValue uses the DecodingOptions structure passed to the constructor of the MimeDocument constructor.

If the decodingOptions parameter that was used to create a new instance of the EmailMessage class was passed as a null reference (Nothing in Visual Basic), TryGetValue assumes that the encoding is UTF8.