473,770 Members | 2,135 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to read/write extended file properties with c#

Hi there!

Hope anybody can help. I want to at least read (maybe write) the extended
file properties of office documents like winword, excel, ....

I've tried two ways till now, one by opening the responding application
(this method was to slow for my needs).

The other way was using the dsofile.dll from microsoft. With that, first, it
seemed to work.
But then I've realized, that if any file properties are read with that dll,
the file stays open. the next time i try to read this file properties, i get
an error that the file is already open.
I've to close my app, and then restart. Than it works again. That's not
pretty nice. I set the reader = null in my routine, but it seems so, that
this dll keeps the file open somewhere in background.

Any ideas or other ways, to catch these informations like author, title,
comments,...

thanks alot!
Nov 16 '05 #1
4 14947
Markus,

Try to do the following before nulling out the COM reference:

Marshal.Release ComObject(reade r);

"Markus Brenner" <ma************ @weinhandl.com> wrote in message
news:OE******** ******@TK2MSFTN GP10.phx.gbl...
Hi there!

Hope anybody can help. I want to at least read (maybe write) the extended
file properties of office documents like winword, excel, ....

I've tried two ways till now, one by opening the responding application
(this method was to slow for my needs).

The other way was using the dsofile.dll from microsoft. With that, first, it seemed to work.
But then I've realized, that if any file properties are read with that dll, the file stays open. the next time i try to read this file properties, i get an error that the file is already open.
I've to close my app, and then restart. Than it works again. That's not
pretty nice. I set the reader = null in my routine, but it seems so, that
this dll keeps the file open somewhere in background.

Any ideas or other ways, to catch these informations like author, title,
comments,...

thanks alot!


Nov 16 '05 #2
Thanks for answer - but doesn't work, too.
damn

any other ideas???

ng

"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> schrieb
im Newsbeitrag news:#c******** ******@TK2MSFTN GP11.phx.gbl...
Markus,

Try to do the following before nulling out the COM reference:

Marshal.Release ComObject(reade r);

"Markus Brenner" <ma************ @weinhandl.com> wrote in message
news:OE******** ******@TK2MSFTN GP10.phx.gbl...
Hi there!

Hope anybody can help. I want to at least read (maybe write) the extended file properties of office documents like winword, excel, ....

I've tried two ways till now, one by opening the responding application
(this method was to slow for my needs).

The other way was using the dsofile.dll from microsoft. With that, first,
it
seemed to work.
But then I've realized, that if any file properties are read with that

dll,
the file stays open. the next time i try to read this file properties, i

get
an error that the file is already open.
I've to close my app, and then restart. Than it works again. That's not
pretty nice. I set the reader = null in my routine, but it seems so,

that this dll keeps the file open somewhere in background.

Any ideas or other ways, to catch these informations like author, title,
comments,...

thanks alot!

Nov 16 '05 #3
You might want to review the KB224351 Knowledge Base article.
Or, you can try to use the IPropertyStorag e and IPropertySetSto rage
interfaces directly.

"Markus Brenner" <ma************ @weinhandl.com> wrote in message
news:u2******** ******@tk2msftn gp13.phx.gbl...
Thanks for answer - but doesn't work, too.
damn

any other ideas???

ng


Nov 16 '05 #4
I've done everything like in KB224351 written, I've also looked at example
of that dll. Don't have any plan, what to do else.

Maybe I try using the interfaces you've written. Thanks anyway.

ng

"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> schrieb
im Newsbeitrag news:Ob******** ******@TK2MSFTN GP09.phx.gbl...
You might want to review the KB224351 Knowledge Base article.
Or, you can try to use the IPropertyStorag e and IPropertySetSto rage
interfaces directly.

"Markus Brenner" <ma************ @weinhandl.com> wrote in message
news:u2******** ******@tk2msftn gp13.phx.gbl...
Thanks for answer - but doesn't work, too.
damn

any other ideas???

ng

Nov 16 '05 #5

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

Similar topics

4
6659
by: see_mun_lee | last post by:
I use asp to develop a web page to read an excel file containing Chinese Character then display it in the web page. Unfortunately, I cant display it!!! it will display (?????????). <META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8"> ' create and open the connection to the Excel file Set conn = Server.CreateObject("ADODB.Connection") conn.Open "DRIVER=Microsoft Excel Driver (*.xls);" & "DBQ=" &...
4
2672
by: Tyrone | last post by:
How do you go about reading the extended properties of a file. (jpg)
3
5491
by: Frank | last post by:
Hi, the problem I have is that an older dos program is using dbase 3 or 4 database files and I wish to add a little utility that scanns this database, and if specific record has a certain entry (flag) i wish to extract all of the records for this entry change the flag in the dbase file and write it into a new mdb database. The second part is no problem, i can hook into mdb databases and do all that stuff, but I cannot seem to create a...
4
6081
by: Hardy Wang | last post by:
Hi all, I have following code to read Excel content into a DataSet string connection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileName + ";Extended Properties=\"Excel 8.0;HDR=YES;IMEX=1;\""; OleDbConnection conn = new OleDbConnection(connection); try { DataSet ds = new DataSet(); conn.Open();
1
3325
by: Tina | last post by:
I need to obtain the extended file properties, such as Owner, Title, etc, for a file in a .net program. I have looked through the FileInfo class and I cannot see any methods or properties that will expose this. In the old days we used to use GetFileInfo but I don't see it in .Net anywhere. How can I get this information? Thanks, T
11
2204
by: sweetpotatop | last post by:
Hi, I wonder if it is possible to read the content of an excel spreadsheet through aspnet. The spreadsheet (workbook) is protected and it resides in a network drive. Please provide sample code if possible. Thanks in advance. Your help is greatly appreciated.
5
43430
by: barbara_dave | last post by:
Hi All, I need to read data from a Excel spreadsheet, but I got the problem when I tried the code below: StringBuilder sbConn = new StringBuilder(); sbConn.Append(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" ); sbConn.Append(excelFile); sbConn.Append(";Extended Properties="); sbConn.Append(Convert.ToChar(34));
0
1625
by: minhtran | last post by:
Hi Everyone Lately, I found the code as to read all file from Excel file as ".xls" from Excel before 2007, but does not work for ".xlsx" Excel 2007, Please, any help for me (new hired database Developer). A great appreciation from me. Thank you all, the code as below (this code from Internet) TextFilename = Left(TextFilename, Len(TextFilename) - 4) TextFilename += ".txt" If File.Exists(TextFilename) Then ...
1
3234
by: =?Utf-8?B?TWFyaw==?= | last post by:
How can I read extended attributes from a file ? For example I have tiff file and with it there are connected some additional information Width, Height, Pages etc. I couldn't find any usefull information how to read it. Is there easy way without using COM object like in the problems with office file ? Greetings Mark M.
0
9591
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
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
10228
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10057
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
8883
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
7415
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
5312
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3970
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

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.