How to convert and view attachments

View email/file attachments in the same way as you would view any other documents.

There are many different use cases when you need to view/preview attachments form an emails, save attachments to specific location, parse or extract attachments. So we made this process easy and simple with GroupDocs.Viewer for .NET API.

GroupDocs.Viewer supports attachments from following formats:

  • Email attachments
  • Outlook attachments
  • Archives
  • PDF

To view attachments just follow steps below:

Following code snippet demonstrates on how to view attachments from MSG file.

Attachment attachment = new Attachment("attachment-word.doc");           
MemoryStream attachmentStream = new MemoryStream();

using (Viewer viewer = new Viewer("sample.msg"))
    viewer.SaveAttachment(attachment, attachmentStream); 

using (Viewer viewer = new Viewer(attachmentStream))
    HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources();

More resources

Advanced Usage Topics

To learn more about document viewing features, please refer to the advanced usage section.

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App

Along with full-featured .NET library we provide simple but powerful free Apps. You are welcome to view Word, PDF, Excel, PowerPoint documents with free to use online GroupDocs Viewer App.