How read file attributes from within C# app?

R

Ronald S. Cook

I have files that contain text in the "Comments" attribute (like if you were
to right-click the file and then click properties etc).

How can I read these falues programatically from within my C# app? I'm
assuming System.IO will be needed but I'm not sure how to get at these types
of values.

Any help would be greatly appreciated.

Thanks,
Ron
 
A

Arthur

using System;
using System.Collections.Generic;
using System.Text;
using s = Shell32;
using System.IO;

namespace Shell
{
class Program
{
static void Main(string[] args)
{
s.ShellClass sh = new s.ShellClass();
String[] arrHeaders = new string[35];
s.Folder dir =
sh.NameSpace(Path.GetDirectoryName(@"C:/Ebooks/foundation.pdf"));
s.FolderItem item =
dir.ParseName(Path.GetFileName(@"C:/Ebooks/foundation.pdf"));
for (int i = 0; i < 35; i++)
{
Console.WriteLine(dir.GetDetailsOf(item,
i).ToString());
}
Console.ReadLine();
}
}
}

Please add a reference to 'Microsoft Shell Controls and Automation' .HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top