How read file properties like Keywords, Comments?

R

Ronald S. Cook

Right-click on a file (e.g. a .wmv file) in Windows Explorer and there's the
"General" tab with Date Created, Attributes (i.e. whether the file is read
only or and.or hidden), and other properties. I can get at these values
programatically via the System.IO namespace and the FileInfo method:

FileInfo file = new FileInfo(@"C:\Data\MyFile.wmv");

Response.Write("Location :" + file.FullName + "<BR/>" +
"Size :" + file.Length + "<BR/>" +
"Created :" + file.CreationTime + "<BR/>" +
"Modified :" + file.LastWriteTime + "<BR/>" +
"Accessed :" + file.LastAccessTime + "<BR/>" +
"Attributes :" + file.Attributes + "<BR/>" +
"Extension :" + file.Extension + "<BR>");

But (on many files when you right-click), there is also a "Summary" tab with
Title, Subject, Keywords, Comments, etc. How can I read these values
programatically?

Thanks,
Ron
 
D

Dave Sexton

Hi Ron,

Those properties differ by file type. Currently, there is no fully managed
way to get these properties, AFAIK. Do a search on groups.google.com and
you'll find some information. IIRC, there is some API functions you can
use.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

There is no support for that in the framework, you will have ot P/invoke
some win functions for that.

Before I suggest you to make a search in the usual sites ( sourceforge.net ,
codeproject.com, etc) to see if anybody implemented this before.
IIRC this was done using an alternate (or secondary) storage stream in the
file. Also look in the archives to get a better explanation of how this is
implemented.


--
Ignacio Machin
machin AT laceupsolutions com

| Right-click on a file (e.g. a .wmv file) in Windows Explorer and there's
the
| "General" tab with Date Created, Attributes (i.e. whether the file is read
| only or and.or hidden), and other properties. I can get at these values
| programatically via the System.IO namespace and the FileInfo method:
|
| FileInfo file = new FileInfo(@"C:\Data\MyFile.wmv");
|
| Response.Write("Location :" + file.FullName + "<BR/>" +
| "Size :" + file.Length + "<BR/>" +
| "Created :" + file.CreationTime + "<BR/>" +
| "Modified :" + file.LastWriteTime + "<BR/>" +
| "Accessed :" + file.LastAccessTime + "<BR/>" +
| "Attributes :" + file.Attributes + "<BR/>" +
| "Extension :" + file.Extension + "<BR>");
|
| But (on many files when you right-click), there is also a "Summary" tab
with
| Title, Subject, Keywords, Comments, etc. How can I read these values
| programatically?
|
| Thanks,
| Ron
|
|
 

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