Adding metadata properties is the most sophisticated feature of the GroupDocs.Metadata search engine. When you call the AddProperties method it examines all available metadata packages and tries to pick up a known property that would satisfy the specified predicate. Note that the property will be added to metadata packages that fit the following criteria:
Only existing metadata packages will be affected. No new packages are added during this operation
There should be a known metadata property in the package structure that fits the search condition but is actually missing in the package. All properties supported by a certain package are usually defined in the specification of a particular metadata standard
AdvancedUsage.AddingMetadata
foreach(stringfileinDirectory.GetFiles(Constants.InputPath)){using(Metadatametadata=newMetadata(file)){if(metadata.FileFormat!=FileFormat.Unknown&&!metadata.GetDocumentInfo().IsEncrypted){Console.WriteLine();Console.WriteLine(file);// Add a property containing the file last printing datevaraffected=metadata.AddProperties(p=>p.Tags.Contains(Tags.Time.Printed),newPropertyValue(DateTime.Now));Console.WriteLine("Affected properties: {0}",affected);metadata.Save(Path.Combine(Constants.OutputPath,"output"+Path.GetExtension(file)));}}}
More resources
GitHub examples
You may easily run the code above and see the feature in action in our GitHub examples:
Along with full featured .NET 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.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.