API Reference
MhtmlDocument
Represents an MHTML web archive as an HTML document plus its decoded MIME related resources.
Inheritance
- Object
- MhtmlDocument
Usage
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by
- Method MhtmlDocument.Load
- Method MhtmlDocument.Load
- Method MhtmlDocument.LoadAsync
- Method MhtmlDocument.LoadAsync
Constructors
public MhtmlDocument(String html, IEnumerable<MhtmlResource> resources = null, String contentLocation = null, String rootContentId = null, String subject = null, HtmlConversionDocumentOptions htmlOptions = null) #Creates an MHTML document from HTML and optional related resources.
Parameters
- html System.String
- resources System.Collections.Generic.IEnumerable{OfficeIMO.Html.MhtmlResource} = null
- contentLocation System.String = null
- rootContentId System.String = null
- subject System.String = null
- htmlOptions OfficeIMO.Html.HtmlConversionDocumentOptions = null
Methods
public Void ConfigureRenderOptions(HtmlRenderOptions options) #VoidApplies the archive base URI, resource-only URL policy, and embedded-resource resolver to render options. The hyperlink policy is left unchanged, and an existing resolver remains a policy-checked fallback for resources absent from the archive.
Parameters
- options OfficeIMO.Html.HtmlRenderOptions
public HtmlRenderResourceResolver CreateResourceResolver() #HtmlRenderResourceResolverCreates a resolver that serves only resources embedded in this archive.
public static MhtmlDocument Load(String path, EmailReaderOptions mimeOptions = null, HtmlConversionDocumentOptions htmlOptions = null, CancellationToken cancellationToken = null) #MhtmlDocumentLoads an MHTML archive from a file.
Parameters
- path System.String
- mimeOptions OfficeIMO.Email.EmailReaderOptions = null
- htmlOptions OfficeIMO.Html.HtmlConversionDocumentOptions = null
- cancellationToken System.Threading.CancellationToken = null
public static MhtmlDocument Load(Stream stream, EmailReaderOptions mimeOptions = null, HtmlConversionDocumentOptions htmlOptions = null, CancellationToken cancellationToken = null) #MhtmlDocumentLoads an MHTML archive from a caller-owned stream.
Parameters
- stream System.IO.Stream
- mimeOptions OfficeIMO.Email.EmailReaderOptions = null
- htmlOptions OfficeIMO.Html.HtmlConversionDocumentOptions = null
- cancellationToken System.Threading.CancellationToken = null
public static async Task<MhtmlDocument> LoadAsync(String path, EmailReaderOptions mimeOptions = null, HtmlConversionDocumentOptions htmlOptions = null, CancellationToken cancellationToken = null) #Task<MhtmlDocument>Asynchronously loads an MHTML archive from a file.
Parameters
- path System.String
- mimeOptions OfficeIMO.Email.EmailReaderOptions = null
- htmlOptions OfficeIMO.Html.HtmlConversionDocumentOptions = null
- cancellationToken System.Threading.CancellationToken = null
public static async Task<MhtmlDocument> LoadAsync(Stream stream, EmailReaderOptions mimeOptions = null, HtmlConversionDocumentOptions htmlOptions = null, CancellationToken cancellationToken = null) #Task<MhtmlDocument>Asynchronously loads an MHTML archive from a caller-owned stream.
Parameters
- stream System.IO.Stream
- mimeOptions OfficeIMO.Email.EmailReaderOptions = null
- htmlOptions OfficeIMO.Html.HtmlConversionDocumentOptions = null
- cancellationToken System.Threading.CancellationToken = null
public Void Save(String path, EmailWriterOptions options = null) #VoidSaves the archive to a file.
Parameters
- path System.String
- options OfficeIMO.Email.EmailWriterOptions = null
public Void Save(Stream stream, EmailWriterOptions options = null) #VoidSaves the archive to a caller-owned stream.
Parameters
- stream System.IO.Stream
- options OfficeIMO.Email.EmailWriterOptions = null
public Task<EmailWriteResult> SaveAsync(String path, EmailWriterOptions options = null, CancellationToken cancellationToken = null) #Task<EmailWriteResult>Asynchronously saves the archive to a file.
Parameters
- path System.String
- options OfficeIMO.Email.EmailWriterOptions = null
- cancellationToken System.Threading.CancellationToken = null
public Task<EmailWriteResult> SaveAsync(Stream stream, EmailWriterOptions options = null, CancellationToken cancellationToken = null) #Task<EmailWriteResult>Asynchronously saves the archive to a caller-owned stream.
Parameters
- stream System.IO.Stream
- options OfficeIMO.Email.EmailWriterOptions = null
- cancellationToken System.Threading.CancellationToken = null
public Byte[] ToBytes(EmailWriterOptions options = null) #Byte[]Serializes the archive to deterministic MHTML bytes.
Parameters
- options OfficeIMO.Email.EmailWriterOptions = null
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
Properties
public HtmlConversionDocument HtmlDocument { get; } #Parsed HTML root document.
public IReadOnlyList<MhtmlResource> Resources { get; } #Decoded related resources in archive order.
public String ContentLocation { get; } #Root content location, when declared.
public String RootContentId { get; } #Root Content-ID without angle brackets, when declared.
public Uri BaseUri { get; } #Base URI used for HTML and related-resource resolution.
public IReadOnlyList<EmailDiagnostic> MimeDiagnostics { get; } #Diagnostics produced by the shared bounded MIME reader.