Summary info (Author, Subject, Company, Keywords, Category, ...) in Windows 2000 server and later. For ALL Type of files.

Hi all,

I know DSOleFile is on the net and i use it for most of the files. But when I try to get the summary info for a pdf or even a xml file it gives me an error.!

Any idea or coding I could use to get the summary info of pdf files and xml files. Actually I'd like to have that for any type of file.

So if you can give me the right coding in C# or or something like that for summary info of .doc .xls .pdf .xml .vsd .jpg .tif .msg you get the points.

This is what I had. It works for most of the documents but not all :)

    Sub GetCProps()
        Dim oFilePropReader As DSOleFile.PropertyReader
        Dim oDocProp As DSOleFile.DocumentProperties

        Path = "c:\test\doc.pdf"

            oFilePropReader = New DSOleFile.PropertyReader
            oDocProp = oFilePropReader.GetDocumentProperties(path)
            MessageBox.Show("Author: " & oDocProp.Author & vbCrLf & "Title: " & oDocProp.Title & vbCrLf & "Subject: " & oDocProp.Subject)
        Catch ex As Exception
        End Try

    End Sub

Good luck  :p
Who is Participating?
David LeeConnect With a Mentor Commented:
Hmmm, the link doesn't work for me today either.  In fact every link to specific scripts seems to take me to the ScriptCenter home page.  Seems as if something's changed on that site.  Anyway, here's the code.  Change the folder path on the third line to your folder path.

Dim arrHeaders(34)
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\Testing")
For i = 0 to 33
    arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
For Each strFileName in objFolder.Items
    For i = 0 to 33
        Wscript.echo i & vbtab & arrHeaders(i) _
            & ": " & objFolder.GetDetailsOf(strFileName, i)
David LeeCommented:
DSOleFile is really intended for getting properties of MSOffice files, although Microsoft says it'll work for any OLE compound document when used on Windows 2000, and presumably later, with an NTFS file system.  Here's a link to a Microsoft Knowledgebase article that details that:  There's another approach though that seems to work for any document.  Here's a link to a page that describes it:  The code here is VBScript which should be simple enough to convert to straight VB.  I've tested this code with a variety of files including jpg, gif, html, etc. and it works for all of them.  I don't have a single pdf file that has any properties so I haven't been able to test it against this type of file.
AlexdelenAuthor Commented:
this link doesn't seem to work for me:

Can you put the code over here?


Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

AlexdelenAuthor Commented:
Found it in the meanwhile.

Great job on this. One more additional question do you know any code to modify those props?
David LeeCommented:
Modify them how?  
AlexdelenAuthor Commented:
Now i can read them with this script but is it also possible to modify them (the value) with wscript vbs or anything else?

David LeeCommented:
No, sorry, I don't know of any way to do that.
AlexdelenAuthor Commented:
anyway you helped me on this one and it was very useful

All Courses

From novice to tech pro — start learning today.