Skip to content

Instantly share code, notes, and snippets.

@conholdate-docs-gists
Created August 11, 2022 08:01
Show Gist options
  • Save conholdate-docs-gists/f68231657baf755e3160b5c2298e69ca to your computer and use it in GitHub Desktop.
Save conholdate-docs-gists/f68231657baf755e3160b5c2298e69ca to your computer and use it in GitHub Desktop.
Set metadata properties of a document | https://docs.conholdate.com/net/set-metadata-properties/
// Constants.InputVsdx is an absolute or relative path to your document. Ex: @"C:\Docs\source.vsdx"
using (Metadata metadata = new Metadata(Constants.InputVsdx))
{
// Set the value of each property that satisfies the predicate:
// property contains the date/time the document was created OR modified
var affected = metadata.SetProperties(
p => p.Tags.Contains(Tags.Time.Created) || p.Tags.Contains(Tags.Time.Modified),
new PropertyValue(DateTime.Now));
Console.WriteLine("Properties set: {0}", affected);
metadata.Save(Constants.OutputVsdx);
}
@conholdate-docs-gists
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment