Cheery
Cheery

Reputation: 25463

Retrieve file properties

When in Windows XP, if I open the properties window for the file and click the second tab, I will find a window where to add attributes or remove them.

While developing things, I noticed there was actually something I wanted to know about the file. How to retrieve this data? It's a string with name 'DESCRIPTION'.

The actual tab is saying 'Custom'. I think it's called metadata what it shows.

I noticed that only the files I'm looking at have that tab. It seems to be specific only for the SLDLFP -file.

Upvotes: 1

Views: 733

Answers (3)

crashmstr
crashmstr

Reputation: 28583

I think the custom tab is only available for Office documents, and display custom properties (In Word, File -> Properties, Custom tab).

The best way to get the information would be by using MS Office hooks. Last time I did anything like this, it was using OLE Automation, so good luck!

Edit:
Since you added a mention of SLDLFP, I'm guessing that you are working with SolidWorks files.

There may be some standard APIs for this, but none that I have heard of. Using SolidWorks via Automation is probably going to be your best bet.

I found a link describing how to read these kind of values with a Word 2003 and VB.Net, I would expect that it is similar to how to do this with SolidWorks.

Reading and Writing Custom Document Properties in Microsoft Office Word 2003 with Microsoft Visual Basic .NET

Upvotes: 0

Inisheer
Inisheer

Reputation: 20794

Not on an XP machine, but I think this might work

FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo("path.txt");
string desc = myFileVersionInfo.FileDescription;

Upvotes: 1

shahkalpesh
shahkalpesh

Reputation: 33474

I think this applies to all microsoft office based documents (and not all the other files). You might need to automate word/excel/powerpoint to get that info.

OR you might need some kind of a binary file reader for MSOffice based files to read the attributes.

Upvotes: 0

Related Questions