473,511 Members | 15,852 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How read file attributes from within C# app?

I have files that contain text in the "Comments" attribute (like if you were
to right-click the file and then click properties etc).

How can I read these falues programatically from within my C# app? I'm
assuming System.IO will be needed but I'm not sure how to get at these types
of values.

Any help would be greatly appreciated.

Thanks,
Ron

Jan 4 '07 #1
2 1578
Hi Ron,

A quick search reveals that it's not possible in managed code without some
Interop, perhaps:

http://groups.google.com/groups?lnk=...le+summary+tab

IPropertyStorage is mentioned in several threads.

--
Dave Sexton
http://davesexton.com/blog

"Ronald S. Cook" <rc***@westinis.comwrote in message
news:CD**********************************@microsof t.com...
>I have files that contain text in the "Comments" attribute (like if you
were to right-click the file and then click properties etc).

How can I read these falues programatically from within my C# app? I'm
assuming System.IO will be needed but I'm not sure how to get at these
types of values.

Any help would be greatly appreciated.

Thanks,
Ron

Jan 5 '07 #2
using System;
using System.Collections.Generic;
using System.Text;
using s = Shell32;
using System.IO;

namespace Shell
{
class Program
{
static void Main(string[] args)
{
s.ShellClass sh = new s.ShellClass();
String[] arrHeaders = new string[35];
s.Folder dir =
sh.NameSpace(Path.GetDirectoryName(@"C:/Ebooks/foundation.pdf"));
s.FolderItem item =
dir.ParseName(Path.GetFileName(@"C:/Ebooks/foundation.pdf"));
for (int i = 0; i < 35; i++)
{
Console.WriteLine(dir.GetDetailsOf(item,
i).ToString());
}
Console.ReadLine();
}
}
}

Please add a reference to 'Microsoft Shell Controls and Automation' .HTH

Jan 5 '07 #3

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

Similar topics

21
42984
by: Gavin | last post by:
Hi, I'm a newbie to programming of any kind. I have posted this to other groups in a hope to get a response from anyone. Can any one tell me how to make my VB program read the Bios serial number...
2
2283
by: Martin Huber | last post by:
Hello Newsgroup, I want to make a javascript application, that reads out the directorys on my hard disk and show in a checkbox if a folder is read- or writeable. So I can change attributes on an...
6
5946
by: Samuel M. Smith | last post by:
I have been playing around with a subclass of dict wrt a recipe for setting dict items using attribute syntax. The dict class has some read only attributes that generate an exception if I try to...
1
1745
by: Phil Haddock | last post by:
Can anyone post a code snippet on how to retrieve Permission information on a Folder? (Visual Basic 2005) There's lot's of information on how to set a permission, but I can't figure out how to...
6
7252
by: | last post by:
Hi, I'm steel trying to read and update my XML file with Visual Basic Express but i am unable to find the right way to read my xml file and update it if neccessary... Here is my problem :...
4
10297
by: Alvin SIU | last post by:
Hi all, I have 6 tables inside a MS Access 2003 mdb file. I want to convert them as DB2 version -8 tables in AIX 5.2. I have exported them as 6 XML files. The XML files look fine. Each...
2
5303
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Hi Is there any way to Read an INIFile from a string or Stream instead of a physical file ??? I want to read the INIFile into a string then store in a db but when I read the string from the...
1
2219
by: jmDesktop | last post by:
I know I can use FileAttributes.Normal but it doesn't always work. I am using the FileSystemWatcher class. I have found that if I uncheck the read-only flag from the directory and apply to all...
1
1328
by: TomGo | last post by:
Hi All I want to read out the properties of a field by the instance, which is referenced by the corresponding field. I want to read out the attributes. In a class I wrote the following: ...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7418
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...
1
7075
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...
0
7508
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5662
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3212
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
446
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.