Parser.GetContainer method

Extracts a container object from the document to work with formats that contain attachments, ZIP archives etc.

public IEnumerable<ContainerItem> GetContainer()

Return Value

A collection of container items; null if container extraction isn’t supported.


To check if the format supports extracting attachments see Supported Document Formats (Extract Containers and Attachments column).

Learn more:


The following example shows how to extract attachments from a container:

// Create an instance of Parser class
using(Parser parser = new Parser(filePath))
    // Extract attachments from the container
    IEnumerable<ContainerItem> attachments = parser.GetContainer();
    // Check if container extraction is supported
    if(attachments == null)
        Console.WriteLine("Container extraction isn't supported");
    // Iterate over attachments
    foreach(ContainerItem item in attachments)
        // Print an item name and size
        Console.WriteLine(string.Format("{0}: {1}", item.Name, item.Size));

See Also