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.Mhtml.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. Remote resources absent from the archive are fetched only through the policy's one-hop resolver so every redirect destination is approved before it is requested.
Parameters
- options OfficeIMO.Html.HtmlRenderOptions
public Void ConfigureRenderOptions(HtmlRenderOptions options, MhtmlRemoteResourcePolicy remoteResourcePolicy) #VoidApplies the archive base URI, resource-only URL policy, embedded-resource resolver, and explicit bounded remote-resource policy to render options.
Parameters
- options OfficeIMO.Html.HtmlRenderOptions
- remoteResourcePolicy OfficeIMO.Mhtml.MhtmlRemoteResourcePolicy
public HtmlRenderResourceResolver CreateResourceResolver() #HtmlRenderResourceResolverCreates a resolver that serves only resources embedded in this archive.
public static OfficeContentSafetyReport InspectContentSafety(Byte[] archiveBytes, OfficeContentSafetyOptions options = null, EmailReaderOptions mimeOptions = null, CancellationToken cancellationToken = null) #OfficeContentSafetyReportInspects concealed machine-readable HTML in a bounded MHTML archive.
Parameters
- arg1 System.Byte[]
- arg2 OfficeIMO.ContentSafety.OfficeContentSafetyOptions = null
- arg3 OfficeIMO.Email.EmailReaderOptions = null
- arg4 System.Threading.CancellationToken = null
public static OfficeContentSafetyReport InspectContentSafety(String filePath, OfficeContentSafetyOptions options = null, EmailReaderOptions mimeOptions = null, CancellationToken cancellationToken = null) #OfficeContentSafetyReportInspects concealed machine-readable HTML in a bounded MHTML file.
Parameters
- arg1 System.String
- arg2 OfficeIMO.ContentSafety.OfficeContentSafetyOptions = null
- arg3 OfficeIMO.Email.EmailReaderOptions = null
- arg4 System.Threading.CancellationToken = null
public static MhtmlDocument Load(String path, EmailReaderOptions mimeOptions = null, HtmlConversionDocumentOptions htmlOptions = null, CancellationToken cancellationToken = null) #MhtmlDocumentLoads an MHTML archive from a file.
Parameters
- arg1 System.String
- arg2 OfficeIMO.Email.EmailReaderOptions = null
- arg3 OfficeIMO.Html.HtmlConversionDocumentOptions = null
- arg4 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
- arg1 System.IO.Stream
- arg2 OfficeIMO.Email.EmailReaderOptions = null
- arg3 OfficeIMO.Html.HtmlConversionDocumentOptions = null
- arg4 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
- arg1 System.String
- arg2 OfficeIMO.Email.EmailReaderOptions = null
- arg3 OfficeIMO.Html.HtmlConversionDocumentOptions = null
- arg4 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
- arg1 System.IO.Stream
- arg2 OfficeIMO.Email.EmailReaderOptions = null
- arg3 OfficeIMO.Html.HtmlConversionDocumentOptions = null
- arg4 System.Threading.CancellationToken = null
public static OfficeContentCleanupResult RemoveSelectedContent(Byte[] archiveBytes, OfficeContentCleanupSelection selection, OfficeContentCleanupOptions options = null, EmailReaderOptions mimeOptions = null, CancellationToken cancellationToken = null) #OfficeContentCleanupResultRemoves exact selected concealed HTML findings, then reopens and reinspects the MHTML archive.
Parameters
- archiveBytes System.Byte[]
- selection OfficeIMO.ContentSafety.OfficeContentCleanupSelection
- options OfficeIMO.ContentSafety.OfficeContentCleanupOptions = null
- mimeOptions OfficeIMO.Email.EmailReaderOptions = null
- cancellationToken System.Threading.CancellationToken = null
public static OfficeContentCleanupResult RemoveSelectedContent(String inputPath, String outputPath, OfficeContentCleanupSelection selection, OfficeContentCleanupOptions options = null, EmailReaderOptions mimeOptions = null, CancellationToken cancellationToken = null) #OfficeContentCleanupResultAtomically writes an explicitly cleaned MHTML artifact.
Parameters
- inputPath System.String
- outputPath System.String
- selection OfficeIMO.ContentSafety.OfficeContentCleanupSelection
- options OfficeIMO.ContentSafety.OfficeContentCleanupOptions = null
- mimeOptions OfficeIMO.Email.EmailReaderOptions = 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 String Html { get; } #Original HTML root source.
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 String Subject { get; } #Optional archive subject.
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.