Retrieving the Summary properties of a file

While right clicking a file in the explorer view, we find a Summary tab that contain properties such as Author, LastSavedBy, RevisionNumber, CharacterCount, PageCount, Title, Subject, CreatedTime, ModifiedTime etc.

We can find some of the properties such as CreatedTime and ModifiedTime in VB.Net using FileInfo Class.However we cant find the some of the summary properties such as Author name, LastSavedBy name using FileInfo Class which can be retrieved using the DSO OleDocument Properties Reader 2.0 library

 Dim filename as string="c:\test\test.doc"
 Dim dso As DSOFile.OleDocumentProperties
 dso = New DSOFile.OleDocumentProperties
 dso.Open(filename.Trim, True,      DSOFile.dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess)
 Console.WriteLine(dso.SummaryProperties.Author)
 Console.WriteLine(dso.SummaryProperties.ByteCount)
 Console.WriteLine(dso.SummaryProperties.CharacterCount)
 Console.WriteLine(dso.SummaryProperties.CharacterCountWithSpaces)
 Console.WriteLine(dso.SummaryProperties.Comments)
 Console.WriteLine(dso.SummaryProperties.Company)
 Console.WriteLine(dso.SummaryProperties.DateCreated)
 Console.WriteLine(dso.SummaryProperties.DateLastSaved)
 Console.WriteLine(dso.SummaryProperties.LastSavedBy)
 Console.WriteLine(dso.SummaryProperties.LineCount)
 Console.WriteLine(dso.SummaryProperties.PageCount)
 Console.WriteLine(dso.SummaryProperties.ParagraphCount)
 Console.WriteLine(dso.SummaryProperties.RevisionNumber)
 Console.WriteLine(dso.SummaryProperties.Subject)
 Console.WriteLine(dso.SummaryProperties.Title)
 Console.WriteLine(dso.SummaryProperties.WordCount)

You can use this code to find the summary properties of any kind of file - not just Word documents. To use this code, you have add reference of DSO OleDocument Properties Reader 2.0 library which can be downloaded free - DSO OleDocument Properties Reader 2.0

You might also like...

Comments

 Praveena

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“In order to understand recursion, one must first understand recursion.”