locked
Windows Explorer extended file properties? RRS feed

  • Question

  • I need to be able to access a file's "extended" attributes. For example, if I open Windows Explorer on Windows 7 Pro and list the contents of a directory, in the right pane I see Name, Date Modified, Type and Size. I can right-click on the header of that pane and get a checkbox list of details I can add to the pane (i.e., Date Created, Authors, Title, etc.).

    I don't think that FileSystemInfo exposes these "details". I am looking for the "tags" detail. I think it is a list of strings. How can I get at this property?

    Thanks, Larry
    Monday, February 8, 2010 7:05 PM

Answers

  • Reference shell32.dll and use GetDetailsOf.  List the columns to find the name of the items and then the items of the file in which you're interested.

    • Marked as answer by eryang Wednesday, February 17, 2010 11:02 AM
    Tuesday, February 9, 2010 8:55 AM
  • Hi,
    You can use FileInfo class to get attributes of specified file, hope following code snippet helps:

                    string filePath = "D:\\mydoc.txt";
                    FileInfo file = new FileInfo(filePath);
                    Console.WriteLine("Name:{0}", file.Name);
                    Console.WriteLine("Date created:{0}", file.CreationTime);
                    Console.WriteLine("Data modified:{0}", file.LastWriteTime);
                    Console.WriteLine("Size:{0} bytes", file.Length);

    Sincerely,
    Eric
    • Marked as answer by eryang Wednesday, February 17, 2010 11:02 AM
    Tuesday, February 9, 2010 8:40 AM

All replies

  • Hi,
    You can use FileInfo class to get attributes of specified file, hope following code snippet helps:

                    string filePath = "D:\\mydoc.txt";
                    FileInfo file = new FileInfo(filePath);
                    Console.WriteLine("Name:{0}", file.Name);
                    Console.WriteLine("Date created:{0}", file.CreationTime);
                    Console.WriteLine("Data modified:{0}", file.LastWriteTime);
                    Console.WriteLine("Size:{0} bytes", file.Length);

    Sincerely,
    Eric
    • Marked as answer by eryang Wednesday, February 17, 2010 11:02 AM
    Tuesday, February 9, 2010 8:40 AM
  • Reference shell32.dll and use GetDetailsOf.  List the columns to find the name of the items and then the items of the file in which you're interested.

    • Marked as answer by eryang Wednesday, February 17, 2010 11:02 AM
    Tuesday, February 9, 2010 8:55 AM
  •  

    We temporarily mark a reply, please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.


    Sincerely,
    Eric
    Wednesday, February 17, 2010 11:01 AM