add_properties method
Leave feedback
On this page
Adds known metadata properties satisfying the specified predicate, recursively affecting all nested packages.
Learn more
- More examples demonstrating usages of this method: https://docs.groupdocs.com/display/metadatanet/Adding+metadata
def add_properties(self, predicate, value):
...
| Parameter | Type | Description |
|---|---|---|
| predicate | Func[MetadataProperty, bool] |
A function to test each metadata property for a condition. |
| value | PropertyValue |
A value for the picked properties. |
Returns: int: The number of affected properties.
from datetime import datetime
from groupdocs.metadata import Metadata
from groupdocs.metadata.common import PropertyValue
from groupdocs.metadata.tagging import Tags
def adding_metadata():
with Metadata("input.docx") as metadata:
property_value = PropertyValue(datetime.now())
affected = metadata.add_properties(
lambda p: Tags.time.printed in list(p.tags), property_value
)
print(f"Affected properties: {affected}")
metadata.save("output.docx")
- class
MetadataPackage
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.