473,323 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

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 14915
Markus,

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

Marshal.ReleaseComObject(reader);

"Markus Brenner" <ma************@weinhandl.com> wrote in message
news:OE**************@TK2MSFTNGP10.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.com> schrieb
im Newsbeitrag news:#c**************@TK2MSFTNGP11.phx.gbl...
Markus,

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

Marshal.ReleaseComObject(reader);

"Markus Brenner" <ma************@weinhandl.com> wrote in message
news:OE**************@TK2MSFTNGP10.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 IPropertyStorage and IPropertySetStorage
interfaces directly.

"Markus Brenner" <ma************@weinhandl.com> wrote in message
news:u2**************@tk2msftngp13.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.com> schrieb
im Newsbeitrag news:Ob**************@TK2MSFTNGP09.phx.gbl...
You might want to review the KB224351 Knowledge Base article.
Or, you can try to use the IPropertyStorage and IPropertySetStorage
interfaces directly.

"Markus Brenner" <ma************@weinhandl.com> wrote in message
news:u2**************@tk2msftngp13.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
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...
4
by: Tyrone | last post by:
How do you go about reading the extended properties of a file. (jpg)
3
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...
4
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...
1
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...
11
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...
5
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();...
0
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...
1
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.