Find metadata properties

Use tags to find most common metadata properties

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:

  1. Load a file to examine
  2. Make up a predicate checking that a specific tag is assigned to a property (alternatively you can use a combination of tags)
  3. Pass the predicate to the findProperties method
  4. 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
with gm.Metadata(constants.input_pptx) as metadata:
        specification = gm.search.ContainsTagSpecification(gm.tagging.Tags.person.editor).either(gm.search.ContainsTagSpecification(gm.tagging.Tags.time.modified))
        properties = metadata.find_properties(specification)
        for property in properties:
             print(f"Property name: {property.name}, Property value: {property.value}")

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:

More resources

Advanced usage topics

To learn more about library features and get familiar how to manage metadata and more, please refer to theadvanced usage section.

GitHub examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free online document metadata management App

Along with a full featured Java library we provide simple, but powerful free Apps.

You are welcome to view and edit metadata of PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, emails, images and more with our free online Free Online Document Metadata Viewing and Editing App.