473,668 Members | 2,406 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 1584
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

IPropertyStorag e is mentioned in several threads.

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

"Ronald S. Cook" <rc***@westinis .comwrote in message
news:CD******** *************** ***********@mic rosoft.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.Collecti ons.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(Pa th.GetDirectory Name(@"C:/Ebooks/foundation.pdf" ));
s.FolderItem item =
dir.ParseName(P ath.GetFileName (@"C:/Ebooks/foundation.pdf" ));
for (int i = 0; i < 35; i++)
{
Console.WriteLi ne(dir.GetDetai lsOf(item,
i).ToString());
}
Console.ReadLin e();
}
}
}

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
43029
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 (or would HDD be better, or both?) and put that info into VB prog so the program won't work on another computer. My program uses an MSAccess table. Much appreciated if you can help! Thanks
2
2287
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 easy and fast way. My problem is, that I don´t know how to read out the read- and writeable attributes. Thank you
6
5991
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 assign a value to them. I wanted to trap for this exception in a subclass using super but it doesn't happen. I have read Guido's tutorial on new style classes and Shalabh's tuturial on new style attributes and methods, and thought I understood...
1
1757
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 read them. I want to be able to return what Users and Groups have what permissions on the folder. I'm not interested in the files within, although I know that they may vary from the folder itself. Thanks,
6
7264
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 : evry day, i store the number of children in my classroom in my XML file. For exemple, on monday, my app ask me something like this : msgbox ("Are the 28 children here today ?",vbyesno)
4
10314
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 record is embeded by a tag which is the table name.
2
5339
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 db or save string to the db I don't want to have to copy the string to a file to use the WritePrivateProfileString and GetPrivateProfileString. Is there a way around this instead of writing my own class to operate on a string or stream ???
1
2227
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 sub folders and files the check will go away on the file. If I use the class it never gets unset. I wanted to know if there was a way to activate the uncheck apply to all programatically. thanks
1
1335
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: class A { private Bb testing1 = new Bb();
0
8382
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8802
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8658
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7405
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6209
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4384
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2792
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2028
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1787
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.