?
Solved

Returning all documents with document properties of null

Posted on 2003-03-22
3
Medium Priority
?
709 Views
Last Modified: 2008-06-16
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***
0
Comment
Question by:jvriends
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Accepted Solution

by:
cirtap earned 300 total points
ID: 8192477
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

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The viewer will learn how to count occurrences of each item in an array.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question