To make manipulating metadata easier we attach specific tags to the most commonly used metadata properties extracted from a file. Some metadata standards can have quite a complex structure. Moreover, in most cases, one image, video or document contains more than one metadata packages. Using tags you can search for desirable properties with a few lines of code without even knowing the exact format of the loaded file.
The code sample below demonstrates how to search for specific metadata properties using tags:
// Constants.InputPptx is an absolute or relative path to your document. Ex: @"C:\Docs\source.pptx"try(Metadatametadata=newMetadata(Constants.InputPptx)){// Fetch all the properties satisfying the predicate:// property contains the name of the last document editor OR the date/time the document was last modifiedIReadOnlyList<MetadataProperty>properties=metadata.findProperties(newContainsTagSpecification(Tags.getPerson().getEditor()).or(newContainsTagSpecification(Tags.getTime().getModified())));for(MetadataPropertyproperty:properties){System.out.println(String.format("Property name: %s, Property value: %s",property.getName(),property.getValue()));}}
As a result, we obtain all metadata properties containing the name of the person last edited the document and all properties that store the date/time the document was last edited.
For more information on supported features of the GroupDocs.Metadata search engine please refer to the following articles: