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-system:
The following way doesn't give me access to the tags of the file, but only to other file properties.
string file = @"C:\Users\me\Desktop\MyFile.doc";
FileInfo oFileInfo = new FileInfo(file);
MessageBox.Show(oFileInfo.FullName);
Any ideas how to access the tags using the simple API of System.IO
?
This assumption is wrong. You can't add tags to all file types. See here:
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:
And this post shows how the OP successfully adds tags via
ShellFile
.Also recommended reading: Getting and Setting File Tag Meta Information in C#