Extract from ZIP or Attachments

Extract from ZIP in C#

GroupDocs.Parser (which is a part of Conholdate.Total for .NET) allows you to extract documents from ZIP files and get attachments from containers simply call the GetContainer method.

IEnumerable<ContainerItem> GetContainer()

This method returns a collection of ContainerItem objects.

Member Description
Name The name of the item.
Directory The directory of the item.
FilePath The full path of the item.
Size The size of the item in bytes.
Metadata The collection of item metadata.
Stream OpenStream() Opens the stream of the item content.
Parser OpenParser() Creates the Parser object for the item content.
Parser OpenParser(LoadOptions) Creates the Parser object for the item content with LoadOptions.
Parser OpenParser(LoadOptions, ParserSettings) Creates the Parser object for the item content with LoadOptions and ParserSettings.

Container means that both container-only files (like zip archives, outlook storage) and documents with attachments (like emails, PDF Portfolios).

Follow the steps below to extract an email text from outlook storage

  • Instantiate Parser object for the initial document.
  • Call GetContainer method and obtain collection of document container item objects.
  • Check if collection isn’t null (container extraction is supported for the document).
  • Iterate through the collection and obtain Parser object to extract a text.

The following sample code shows how to extract a text from zip entities.