I would like to add and retrieve tags of files in File System.
As you can tag Stackoverflow question to the relevant topics, you can tag a file in Windows file-s
As you can tag Stackoverflow question to the relevant topics, you can tag a file in Windows file-system
This assumption is wrong. You can't add tags to all file types. See here:
Note
You cannot add or modify the file properties of some types of files. For example, you can add or modify the properties of Microsoft Office documents and Searches, but you can't add or modify the properties of TXT or RTF files.
Besides the types mentioned there are others which can contain custom tags:
Editing/adding/removing those tags should be done with dedicated libraries.
This post has a nice explanation:
In Windows Explorer you can see quite a lot of document properties for many file types. The nice, unified interface suggests that there is some unified property store. That's not really the case. The Explorer Shell has an extensible interface for Property Sheet Handlers that extract this information from various file types. There is a handler for JFIF (JPEG) files, and there are handlers for OLE files (old Office formats), and the new Office formats too.
And this post shows how the OP successfully adds tags via ShellFile
.
Also recommended reading: Getting and Setting File Tag Meta Information in C#