472,780 Members | 1,418 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,780 software developers and data experts.

Getting file properties programatically

Hi All,

I'm trying to programatically (using c#) read the file properties (Title, Summary, Author, Comments etc.... The stuff that shows up on the Summary tab when you see the properties of a file).

FileInfo and FileSystemInfo classes expose only the standard properties (create time, mod time etc..).

Any pointers would be greatly appreciated.

Thanks,
Ram Thiru
Nov 15 '05 #1
5 9776
Jeez! What's the world coming to? A Microsoft guy asking for help here ?!

A similar question was asked a week or so ago.

As I understand it, most of these custom properties are stored as part of the file itself and are retrieved by the application that created the file.

For example:
Title, Summary, Author & Comments that MS Word would save as part of a Word document. When the OS displays these properties they are somehow provided by Word by the OS

As I said that is how I understand it.
HTH
Brian W
"Ram [MSFT]" <ra****@online.microsoft.com> wrote in message news:OT**************@TK2MSFTNGP12.phx.gbl...
Hi All,

I'm trying to programatically (using c#) read the file properties (Title, Summary, Author, Comments etc.... The stuff that shows up on the Summary tab when you see the properties of a file).

FileInfo and FileSystemInfo classes expose only the standard properties (create time, mod time etc..).

Any pointers would be greatly appreciated.

Thanks,
Ram Thiru
Nov 15 '05 #2
Wait for Longhorn and use the new WinFS relational database and some new
..Net API to get to metadata for the file ;-)

More seriously, based on Brian's advice, using Word automation can probably
get to it for a Word document. I'm not an expert on Word automation (haven't
done it since VB6).

This is a somewhat an overview doc, not sure where the real docs are for the
Word object model.
http://msdn.microsoft.com/library/de...WordObject.asp
--
Mike Mayer - Visual C# MVP
http://www.mag37.com/csharp/
mi**@mag37.com
"Ram [MSFT]" <ra****@online.microsoft.com> wrote in message
news:OT**************@TK2MSFTNGP12.phx.gbl...
Hi All,

I'm trying to programatically (using c#) read the file properties (Title,
Summary, Author, Comments etc.... The stuff that shows up on the Summary tab
when you see the properties of a file).

FileInfo and FileSystemInfo classes expose only the standard properties
(create time, mod time etc..).

Any pointers would be greatly appreciated.

Thanks,
Ram Thiru
Nov 15 '05 #3
> More seriously, based on Brian's advice, using Word automation can
probably
get to it for a Word document. I'm not an expert on Word automation (haven't done it since VB6).


You may be able to work something out by having a play with Index Server.
Index Server will index the extended properties of those files and then when
you query the index you can read the properties. May allow you to kill some
more birds with ya stone? Index Server can be an ass to setup though.
Take a look at
http://idunno.org/dotNet/indexserver.aspx
and
http://www.microsoft.com/ntserver/Pr...asp#searchprop

Cheers
Chris

****Please Reply To The Newsgroup So All Can Benefit From Discussion****
-------------------------------------------
Kognition Consulting Limited - Thought Meets Technology
Chris J.T. Auld - Managing Director
Microsoft MVP (Windows Mobile Devices)
Phone: +64 3 453 0064
Mobile: +64 21 500 239
Email: ch***@kognition.co.nz
Nov 15 '05 #4

Have a look at
http://support.microsoft.com/?kbid=224351
http://www.microsoft.com/technet/tre...er/ScrFF64.asp

I also have this code which I never tried!

private void btnSave_Click(object sender, System.EventArgs e)
{
// Set the temporary property to the first of properties that the JPG already has
System.Drawing.Imaging.PropertyItem propTemp = propAllProperties[0];

byte[] Value = System.Text.ASCIIEncoding.Unicode.GetBytes(txtTitl e.Text);
propTemp.Id = 40091; // Title
propTemp.Len = Value.Length;
propTemp.Value = Value;
imgImage.SetPropertyItem(propTemp);

Value = System.Text.ASCIIEncoding.Unicode.GetBytes(txtComm ents.Text);
propTemp.Id = 40092; // Comments
propTemp.Len = Value.Length;
propTemp.Value = Value;
imgImage.SetPropertyItem(propTemp);

Value = System.Text.ASCIIEncoding.Unicode.GetBytes(txtAuth or.Text);
propTemp.Id = 40093; // Author
propTemp.Len = Value.Length;
propTemp.Value = Value;
imgImage.SetPropertyItem(propTemp);

Value = System.Text.ASCIIEncoding.Unicode.GetBytes(txtKeyw ords.Text);
propTemp.Id = 40094; // Keywords
propTemp.Len = Value.Length;
propTemp.Value = Value;
imgImage.SetPropertyItem(propTemp);

Value = System.Text.ASCIIEncoding.Unicode.GetBytes(txtSubj ect.Text);
propTemp.Id = 40095; // Subject
propTemp.Len = Value.Length;
propTemp.Value = Value;
imgImage.SetPropertyItem(propTemp);

try
{
if(saveFileDialog1.ShowDialog() == DialogResult.OK)
{
imgImage.Save(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
catch(Exception ee)
{
}
}
}
}

--

HTH

Éric Moreau, MCSD
Conseiller Principal / Senior Consultant
Concept S2i inc.(www.s2i.com)
"Ram [MSFT]" <ra****@online.microsoft.com> wrote in message news:OT**************@TK2MSFTNGP12.phx.gbl...
Hi All,

I'm trying to programatically (using c#) read the file properties (Title, Summary, Author, Comments etc.... The stuff that shows up on the Summary tab when you see the properties of a file).

FileInfo and FileSystemInfo classes expose only the standard properties (create time, mod time etc..).

Any pointers would be greatly appreciated.

Thanks,
Ram Thiru
Nov 15 '05 #5
"Ram [MSFT]" <ra****@online.microsoft.com> wrote in message
news:OT**************@TK2MSFTNGP12.phx.gbl...
Hi All,
I'm trying to programatically (using c#) read the file properties (Title, Summary, Author, Comments etc.... The stuff that shows up on the Summary tab
when you see the properties of a file). FileInfo and FileSystemInfo classes expose only the standard properties (create time, mod time etc..). Any pointers would be greatly appreciated.


See the following newsgroup post from 2/28/2000. The Summary tab is a
proprietary shell extension, it gets part of its info from direct knowledge
of some file types, and other info from plugins, but the plugin COM
interfaces were never published. Looks like there was some interest in
reverse-engineering them over the years, but it doesn't appear that anyone
ever did.

http://groups.google.com/groups?hl=e...%40cppssbbsa04

HTH.
Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: MSK | last post by:
Hi, Continued to my earlier post regaring "Breakpoints are not getting hit" , I have comeup with more input this time.. Kindly give me some idea. I am a newbie to .NET, recently I installed...
15
by: Matt | last post by:
Is there a way to display the file selection window for a file input field via JavaScript? My goal is to emulate the behavior seen in Yahoo! Mail BETA. When adding an attachment, it displays a...
1
by: tanilov | last post by:
Hi all, I need to read data from an excel file and populate a dataset. After some search I found following code: connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +...
2
by: Ronald S. Cook | last post by:
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....
1
by: Jeremy Chaney | last post by:
It appears that my user.config file got corrupted causing my "InitializeComponent" routine to throw an exception "Root element is missing." when I start my app. I figure I can just go into...
3
by: Jeremy Chaney | last post by:
It appears that my user.config file got corrupted causing my "InitializeComponent" routine to throw the exception "Root element is missing." when I start my app. I figure I can just go into...
0
by: NETCODE | last post by:
I am developing an add-in. I need to retrieve the path of .msi file, located in under project properties, from the deployment project (setup). I was able retieve all project properties of all...
0
by: Andrew | last post by:
Hello, Does anyone know how I can programatically access the file properties displayed in the Summary tab of the file properties under XP and the Details tab of the file properties under...
1
by: Andrew | last post by:
Hello, Does anyone know how I can programatically access the file properties displayed in the Summary tab of the file properties under XP and the Details tab of the file properties under...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.