usmanazizgroupdocs
12/18/2015 - 12:05 PM

InvalidFormatException.cs

//For complete examples and data files, please go to https://github.com/groupdocsmetadata/GroupDocs_Metadata_NET
try
{
    // initialize DocFormat
    DocFormat docFormat = new DocFormat(Common.MapSourceFilePath(filePath));

    // initialize metadata
    DocMetadata docMetadata = docFormat.DocumentProperties;

    // get properties
    Console.WriteLine("Built-in Properties: ");
    foreach (KeyValuePair<string, PropertyValue> property in docMetadata)
    {
        // check if built-in property
        if (docMetadata.IsBuiltIn(property.Key))
        {
            Console.WriteLine("{0} : {1}", property.Key, property.Value);
        }
    } 
}
catch (InvalidFormatException ex)
{
    Console.WriteLine("File is not DOC: {0}", ex.Message);
}