ContainerItemDetectFileType Method |
Namespace: GroupDocs.Parser.Data
detectionMode parameter provides the ability to control file type detection:
The following example shows how to detect file type of container item:
// 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) { // Detect the file type Options.FileType fileType = item.DetectFileType(Options.FileTypeDetectionMode.Default); // Print the name and file type Console.WriteLine(string.Format("{0}: {1}", item.Name, fileType)); } }