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:
Load a file to examine
Make up a predicate checking that a specific tag is assigned to a property (alternatively you can use a combination of tags)
Pass the predicate to the findProperties method
Iterate through the found properties
basic_usage.FindMetadataProperties
// Fetch all the properties satisfying the predicate:
// property contains the name of the last document editor OR the date/time the document was last modified
varsearchSpecification=newgroupdocs.metadata.ContainsTagSpecification(groupdocs.metadata.Tags.getPerson().getEditor()).or(newgroupdocs.metadata.ContainsTagSpecification(groupdocs.metadata.Tags.getTime().getModified()));varmetadataProperties=metadata.findProperties(searchSpecification);for(vari=0;i<metadataProperties.getCount();i++){console.log(`Property name: ${metadataProperties.get_Item(i).getName()}, Property value: ${metadataProperties.get_Item(i).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: