Metadata Examples

If you want to process both standardized and non-standardized metadata fields, you can loop through a KVMetadataList without checking the eKey member – both standardized and non-standardized metadata can be handled in the same way.

However, standardization allows you to handle particular metadata fields differently. Below are some illustrative examples of ways you might use standardized fields to act on documents.

// Ignore non-standardized fields
if(element->eKey == KVMetadataKey_Other)
{
    continue;
}		
// Ignore small images
if(element->eKey == KVMetadataKey_ImageWidth)
{
    int64_t width = *(int64_t*)element->pValue;
    if(width < 200)
    {
        break;
    }
}
// Search for documents created by a certain company
if(element->eKey == KVMetadataKey_Company)
{
    KV_String company = *(KV_String*)element->pValue;
    if(strncmp("OpenText", company.pcString, company.cbSize) == 0)
    {
        return pathToInputFile;
    }
}		
// Find all documents created since the beginning of 2022
if(element->eKey == KVMetadataKey_Created)
{
    int64_t created = *(int64_t*)element->pValue;
    //2022-01-01 00:00:00 UTC in Windows File Time
    if(created > 132854688000000000)
    {
        return pathToInputFile;
    }
}