MetadataAddProperties Method
Adds known metadata properties satisfying the specified predicate. The operation is recursive so it affects all nested packages as well.

Namespace: GroupDocs.Metadata
Assembly: GroupDocs.Metadata (in GroupDocs.Metadata.dll) Version: 21.8
public int AddProperties(
	Func<MetadataProperty, bool> predicate,
	PropertyValue value


Type: GroupDocs.Metadata.CommonFuncMetadataProperty, Boolean
A function to test each metadata property for a condition.
Type: GroupDocs.Metadata.CommonPropertyValue
A value for the picked properties.

Return Value

Type: Int32
The number of affected properties.
Learn more
This example demonstrates how to add some missing metadata properties to a file regardless of its format.
using (Metadata metadata = new Metadata(Constants.InputDocx))
    // Add a property containing the file last printing date if it's missing
    // Note that the property will be added to metadata packages that satisfy the following criteria:
    // 1) Only existing metadata packages will be affected. No new packages are added during this operation
    // 2) 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
    var affected = metadata.AddProperties(p => p.Tags.Contains(Tags.Time.Printed), new PropertyValue(DateTime.Now));

    Console.WriteLine("Affected properties: {0}", affected);

See Also