473,394 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 9819
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.