Created
August 11, 2022 08:01
-
-
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Read the complete article: https://docs.conholdate.com/net/set-metadata-properties/