Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Right-clicking on any file in windows explorer lets you access file properties, including title, subject, author, comments, etc.

 

How can I set these properties using .NET? The FileVersionInfo class lets you retrieve these properties but not set them; I have not found anything to let me set them. :confused:

 

Does anyone know how to do this? Thanks.

  • Leaders
Posted

"Any" file in Windows Explorer does not have file properties such as title, subject, author, and comments. If I am not mistaken, those properties are specific to MS Office Documents... this information is located within the file itself. If you open up a Word File in Notepad, you'll find all of this stuff located at the bottom.

So, in order to change this stuff, you're going to have to open the file and change those somehow (and it'll probably be a little more than just finding the title and changing it, there could be length-prefixes in the file)... you'd have to know the Word file specifications to do this.

Iceplug, USN

One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(

Posted

No, they don't appear to be specific to OFFICE. I can change this info for most files by right-clicking the file in WINDOWS EXPLORER and selecting the PROPERTIES menu item and typing information on the SUMMARY tab (eg, AUTOCAD drawings, SOLIDWORKS part/assy files, vb, cls, jpg, zip, txt, dll, exe, pdf). I'd like to know how do change this info via .NET.

 

"Any" file in Windows Explorer does not have file properties such as title, subject, author, and comments. If I am not mistaken, those properties are specific to MS Office Documents... this information is located within the file itself. If you open up a Word File in Notepad, you'll find all of this stuff located at the bottom.

So, in order to change this stuff, you're going to have to open the file and change those somehow (and it'll probably be a little more than just finding the title and changing it, there could be length-prefixes in the file)... you'd have to know the Word file specifications to do this.

  • Administrators
Posted

Does any information actually appear on the summary tab for all of those file types? The summary information is pulled from the contents of the file itself and differs depending on the file type. If you are using an office document then it is stored in a particular file format that allows summary information to be contained within it (search for Ole Compound File for more information.

Other file types (avi. jpg, mpeg amongst others) also contain information internal to the file - this information is displayed in explorer via a shell extension which knows how to read this embedded data.

Simple text files (.txt, .vb, .cs etc) do not have anywhere internal to the file to store this info.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

  • Administrators
Posted
Yes I do use NTFS and I am aware of the alternate data streams NTFS exposes (which are extra data associated with a filename and are not extra information stored within the same file), these are not the same as the file summary information mentioned in this thread. IIRC NTFS at one point was going to make more use of the alternate streams for such purposes as summary data and this functionality did briefly appear in Win2k betas but was later removed.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
not extra information stored within the same file

 

Who said otherwise?

 

 

this functionality did briefly appear in Win2k betas but was later removed.

 

Then I must be in the Twilight Zone. Every Win2k and XP system I've used has summary info for every NTFS file.

"Who is John Galt?"
  • Leaders
Posted

I'm glad that this isn't how you guys always find an answer to other users' questions.

 

Yes I do use NTFS and I am aware of the alternate data streams NTFS exposes (which are extra data associated with a filename and are not extra information stored within the same file)

 

Based on the described contents and behavior, I would say that this is exactly what mjcatt was referring to. If you are using Win Xp, go to a file's properties and note the tab labeled "Summary". I am pretty sure, however, that the .Net Framework does not contain any classes that relate to these properties.

 

If you are talking about the alternate data streams, a google search lead me to http://www.relsoft.net/datastreams.html, which explains how ADS works. Some more googling should help you figure out how to access these properties. Just keep in mind that this is specific to NTFS (as far as I know). Don't assume all users will have this capability, and realize that you will be using pure platform invoke to do this.

 

P.S. As pointed out by PlausiblyDamp, the summary information found in the ADS is different from summary information which may be stored in office documents, jpegs, etc.

[sIGPIC]e[/sIGPIC]
Posted

These posts do shed light on the subject. I'm using XP and all files on NTFS drives have this summary info. Others (NSF-mounted UNIX, FAT, floppy, memory-stick, etc), do not present this summary info(except if they are file types that contain internal summary info, as PlausiblyDamp points out).

 

So I must decide if I want to confine myself to NTFS (admittedly not a really good idea). But if so, to complete thread on my original question, is there an NTFS API accessible from .NET that gives access to the file summary info?

  • Administrators
Posted

:confused: I stand corrected, I've never tried to manipulate the summary properties of a file through explorer for years, it does work :confused:

Even more annoying before doing the previous post I did attempt to try and nothing was visible and nothing could be edited! Turns out this is very dependant on the file type. .txt you can, .jpeg has additional and you can edit some, .gif and .bmp - nothing editable, .html no tab present. .com you can't but .exe you can.

Ignore my above post(s) - listen to marble_eater instead

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

That's odd, I can modify the summary of all the files you mentioned except html.

 

As for accessing this data in .NET, you'll have to use platform invoke, but that's OK since ADS isn't portable anyway.

"Who is John Galt?"
Posted
Thanks to everyone for responding to my questions. Also thanks to PlausiblyDamp for the link to the interesting article about ADS. Sometimes a guided tour of an overgrown path is the best way to avoid a nasty case of poison oak...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...