How to read/write extended file properties with c#

  • Thread starter Thread starter Markus Brenner
  • Start date Start date
M

Markus Brenner

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

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

Marshal.ReleaseComObject(reader);
 
You might want to review the KB224351 Knowledge Base article.
Or, you can try to use the IPropertyStorage and IPropertySetStorage
interfaces directly.
 
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
 
Back
Top