Retrieve and set file details using windows API?

Viewed 274

I'm not able to programmatically get/set file details on Windows.

I managed to get file size, creation time, last access, but those are information I don't actually need.

I'd like to get/set information like "Author" or "Tag" or every other information you can see in the Details tab in the Properties window of a file, even custom ones (which may vary depending of the file itself).

2 Answers

The properties you are referring to you are not a feature of the file system. Rather they are metadata stored within specific known file formats.

Windows is aware (through file format specific property handlers) of specific formats such as Office documents and common media files, and can extract and present that information via the Windows Property System.

There a number of examples, including propertyedit which is a command line tool that demonstrates how to set, get, enumerate and inspect the schema of any file that has a property handler associated with it.

Perhaps of some interest also in the UWP API, that information can be accessed via various classes in the Windows.Storage.FileProperties namespace.

Related