467,076 Members | 995 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,076 developers. It's quick & easy.

filter by file properties

I'm trying to build a filter for a file search where the search will be able
to filter out certain files according to certain "file properties", like
Owner, Creation Date, etc.
MS does this in some Open dialogs, within the dialog, you can click on
Tools->Search->Advanced and search for files with specified file properties.

Any ideas on how this is done in C#?
Nov 16 '05 #1
  • viewed: 5077
Share:
4 Replies
Hi
You can use the FileVersonInfo class of the diagnostic namespace

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemdiagnosticsfileversioninfoclasstopic.as p

Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #2
Yes, but that doesn't show the custom "properties" that can be added when
you: right click on file (for example MS Word file), click properties, go to
the "Custom" or "Summary" tabs and enter data. Where is this data stored?
And is there an API to access this data?

Thanks.

"Mohamoss" wrote:
Hi
You can use the FileVersonInfo class of the diagnostic namespace

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemdiagnosticsfileversioninfoclasstopic.as p

Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #3
Appearantly there is no managed way to do this in C#, I got this from MS:

http://msdn.microsoft.com/library/de...sofficedev.asp

Excerpt:
How do I access my document properties in an Office document?

You can automate Microsoft Word, Excel or PowerPoint with Visual C++ to
retrieve and manipulate both built-in and custom document properties. For
more information and an example, see HOWTO: Use Visual C++ to Access
DocumentProperties with Automation (Q238393).

You can also retrieve document property information without Automation and
even without the need for the Office application that created the file.
Office documents are OLE compound documents that store document properties in
persistent property sets. These property sets are managed by COM/OLE and can
be retrieved using the IPropertySetStorage and IPropertyStorage interfaces.
For details, see HOWTO: Read Compound Document Properties Directly with VC++
(Q186898) and Dsofile.exe Lets You Edit Office Document Properties from
Visual Basic and Active Server Pages (Q224351).
"Craig" wrote:
Yes, but that doesn't show the custom "properties" that can be added when
you: right click on file (for example MS Word file), click properties, go to
the "Custom" or "Summary" tabs and enter data. Where is this data stored?
And is there an API to access this data?

Thanks.

"Mohamoss" wrote:
Hi
You can use the FileVersonInfo class of the diagnostic namespace

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemdiagnosticsfileversioninfoclasstopic.as p

Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #4
Ok, here's the answer, in case someone is interested:

If you don't want to use automation (automation requires ms office product
be installed),
Do a search for dsofile.dll, ms supplies an executable that will create the
dll and a sample in a directory for you.
http://support.microsoft.com/?kbid=224351

This is a MS library for reading document properties, and using it is
extremely simple:
Add library as reference

DSOleFile.PropertyReader propReader =
new DSOleFile.PropertyReaderClass();
DSOleFile.DocumentProperties docProps=
propReader.GetDocumentProperties("C:\test.doc");

and that's it.


"Craig" wrote:
Appearantly there is no managed way to do this in C#, I got this from MS:

http://msdn.microsoft.com/library/de...sofficedev.asp

Excerpt:
How do I access my document properties in an Office document?

You can automate Microsoft Word, Excel or PowerPoint with Visual C++ to
retrieve and manipulate both built-in and custom document properties. For
more information and an example, see HOWTO: Use Visual C++ to Access
DocumentProperties with Automation (Q238393).

You can also retrieve document property information without Automation and
even without the need for the Office application that created the file.
Office documents are OLE compound documents that store document properties in
persistent property sets. These property sets are managed by COM/OLE and can
be retrieved using the IPropertySetStorage and IPropertyStorage interfaces.
For details, see HOWTO: Read Compound Document Properties Directly with VC++
(Q186898) and Dsofile.exe Lets You Edit Office Document Properties from
Visual Basic and Active Server Pages (Q224351).
"Craig" wrote:
Yes, but that doesn't show the custom "properties" that can be added when
you: right click on file (for example MS Word file), click properties, go to
the "Custom" or "Summary" tabs and enter data. Where is this data stored?
And is there an API to access this data?

Thanks.

"Mohamoss" wrote:
Hi
You can use the FileVersonInfo class of the diagnostic namespace

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemdiagnosticsfileversioninfoclasstopic.as p

Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Nhmiller | last post: by
2 posts views Thread by cefrancke@yahoo.com | last post: by
1 post views Thread by Jay | last post: by
1 post views Thread by Stanley | last post: by
2 posts views Thread by Matthew Wells | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.