Add Property and Value to a binary file - Details Tab RRS feed

  • Question

  • Hello

    I have a C# application, in which I am writing data to file with a .bin extension using binarywriter .  No problems there. What I'm wanting to do, is create a file property and value, so that when a person right clicks the file, selects properties , and the Details tab my custom property and value would appear, but I'm nut sure how I do that on a file I'm creating.

    Any ideas?  Thanks ahead of time

    Monday, April 22, 2019 5:41 PM

All replies

  • The information on the Details page comes from the metadata associated with the file along with any property handlers that are installed for Windows. The metadata for most files is either built into the format itself (in which case you need a property handler installed for Windows). However Windows can also extract this data from an alternative stream. Only file systems that support alternate streams will work. NTFS supports it. 

    Unfortunately .NET does not provide direct access to the alternate streams so you'll need to use a third party library, of which there are a couple. 

    Alternatively the Shell has some functions that can also be used to read/write to the property store that the Details tab uses. Again .NET doesn't support this directly so you'll need to P/Invoke in order to use it.

    Michael Taylor

    Monday, April 22, 2019 6:33 PM