Returning all documents with document properties of null

Our orginazation is making it mandatory for all our staff to insert Document Properties when creating a document in Word, Access, Excel and Power Point for searchability.

Microsoft created a .dll which will allow ASP/VBSCRIPT to search/write to these properties.  The DLL is called: DSOFILE and can be called by using set objPropReader = CreateObject("DSOLEFILE.PropertyReader")

More info about the DLL can be obtained from:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q224351&

I would like to generate a ASP script to scan through a directory and sub directories looking for .doc, .xls, .ppt .mdb documents which have nothing specificed for Author, Keywords, Manager, Comments, Title and Subject.  Does anyone know how this could be done or could help me with some source code.

I'm pretty new to ASP/VBSCRIPT.

Thanks,
 jvriends

***Admin : Edited for content 6-16-08 MM***
jvriendsAsked:
Who is Participating?
 
cirtapConnect With a Mentor Commented:
Hi  jvriends,

this DSO-thing is pretty easy to handle. If you downloaded the file you should have the VB example.
In case you don't have Visual Basic available, here's a simple port of the example in VBScript.
It's just the reading part and I left some of the comments from the original file. I dunno how to put this into ASP but it should just go somewhere inside the <% script block %>

Of course there's no code to loop through the files in a folger or drive or network server :-)
Examples for this can be found in the WSH reference.

'* FILE START
sFile = "X:\PUT\YOUR\FILENAME\HERE.DOC"

set oFilePropReader = CreateObject("DSOLEFILE.PropertyReader")

' Here is where we load the document properties for the file
' selected. The function will return a DocumentProperties object.
' We must have exclusive access to the storage of the file. If
' another app has the file open, this function will raise an error
Set oDocProp = oFilePropReader.GetDocumentProperties(sFile)

On Error Resume Next
' Read in some of the most common properties...
Caption1 = oDocProp.Name
Caption2 = oDocProp.AppName

' The standard document properties are loaded and can be changed
' in this sample. Other properties can be changed as well
Text = oDocProp.Title & vbCrLf
Text = Text & oDocProp.Author & vbCrLf
Text = Text & oDocProp.Comments & vbCrLf
Text = Text & "Subject: " & oDocProp.Subject & vbCrLf
Text = Text & "Category: " & oDocProp.Category & vbCrLf
Text = Text & "Company: " & oDocProp.Company & vbCrLf
Text = Text & "Manager: " & oDocProp.Manager & vbCrLf
Text = Text & "CLSID: " & oDocProp.CLSID & vbCrLf
Text = Text & "ProgID: " & oDocProp.ProgId & vbCrLf
Text = Text & "Word Count: " & oDocProp.WordCount & vbCrLf
Text = Text & "Page Count: " & oDocProp.PageCount & vbCrLf
Text = Text & "Paragraph Count: " & oDocProp.ParagraphCount & vbCrLf
Text = Text & "Line Count: " & oDocProp.LineCount & vbCrLf
Text = Text & "Character Count: " & oDocProp.CharacterCount & vbCrLf
Text = Text & "Character Count (w/spaces): " & oDocProp.CharacterCountWithSpaces & vbCrLf
Text = Text & "Byte Count: " & oDocProp.ByteCount & vbCrLf
Text = Text & "Slide Count: " & oDocProp.SlideCount & vbCrLf
Text = Text & "Note Count: " & oDocProp.PresentationNotes & vbCrLf
Text = Text & "Hidden Slides: " & oDocProp.HiddenSlides & vbCrLf
Text = Text & "MultimediaClips: " & oDocProp.MultimediaClips & vbCrLf
Text = Text & "Last Edited by: " & oDocProp.LastEditedBy & vbCrLf
Text = Text & "Date Created: " & oDocProp.DateCreated & vbCrLf
Text = Text & "Date Last Printed: " & oDocProp.DateLastPrinted & vbCrLf
Text = Text & "Date Last Saved: " & oDocProp.DateLastSaved & vbCrLf
Text = Text & "Total Editing Time (mins): " & oDocProp.TotalEditTime & vbCrLf
Text = Text & "Version: " & oDocProp.Version & vbCrLf
Text = Text & "Revision Number: " & oDocProp.RevisionNumber & vbCrLf
Text = Text & "Template Name: " & oDocProp.Template & vbCrLf
Text = Text & "Presentation Format: " & oDocProp.PresentationFormat & vbCrLf

' Loop through the custom properties collection
For Each oCustProp In oDocProp.CustomProperties
  Text = Text &  oCustProp.Name & ": " & CStr(oCustProp.Value)
  Text = Text &  vbTab & "[" & oCustProp.Type & "]" & vbCrLf
Next

MsgBox Text,vbInformation,Caption1 & "-" & Caption2

'* END OF FILE



To read a named CustomProperty, eg. "SpecialNotes"
  MsgBox oDocProp.CustomProperties("SpecialNotes")

Hope this helps
CirTap
0
All Courses

From novice to tech pro — start learning today.