Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Created September 30, 2019 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GroupDocsGists/1b36d099e167b1936cf41d387a3906e8 to your computer and use it in GitHub Desktop.
Save GroupDocsGists/1b36d099e167b1936cf41d387a3906e8 to your computer and use it in GitHub Desktop.
string outputDirectory = @"C:\output";
using (Viewer viewer = new Viewer("with_attachments.msg"))
{
IList<Attachment> attachments = viewer.GetAttachments();
foreach(Attachment attachment in attachments)
{
string filePath = Path.Combine(outputDirectory, attachment.FileName);
viewer.SaveAttachment(attachment.Id, File.OpenWrite(filePath));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment