Library code snippets
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
Helo i am using the following code to extract the thumbnail from dso properties using Asp.Net application. _DSOFile.OleDocumentProperties dso = _DSOFile.Create.OleDocumentProperties(); try { dso.Open(pFileName, true, _DSOFile.dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess); * * _DSOFile.SummaryProperties properties = dso.SummaryProperties;**
i am experiencing the following error can somebody plz correct me or give me solution for this. i goggled on this i got some information about com dll's doesn't behave properly with Asp.Net application. If i use the same code in windows or console application this is working fine. this is issue with only Asp.Net web application.
error is: catestrophic failure
!--removed tag-->But I must tell that .. this .dll is only applicable to .doc files .. I am not sure whether it is same effective for .rtf or .txt file ?????
can anyone confirm me about this ???
Hi,
Code is working fine very help full.
can u also please provide the code how to retirve the Owner of a file.
from security.
Thanks
john
this code is working ....thanks
Hi
I m getting a Error Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
when edit the properties of .tlf , .bmp Image file using DSO File
I m using Code as
Imports System.runtime.InteropServices
Dim objDocument As New DSOFile.OleDocumentPropertiesClass
objDocument.SummaryProperties.Title = TextBox1.Text
objDocument.SummaryProperties.Subject = TextBox2.Text
objDocument.SummaryProperties.Comments = TextBox6.Text
Please reply to this error as soon as possible
Prashant
Try this out--
Import
System.Runtime.InteropServices.COMException
Can anyone provide me the solution
This properties can be viewed by opening the file and from the file menu click on document properties
Can anyone provide me a help for this
My above question was solved when I used the menu item Website > Add reference > com tab > dso ole document properties reader 2.0.
However, when I try to open a file using:
dso.Open(FileName, True, DSOFile.dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess)
I get this error:
The name is not valid. (Exception from HRESULT: 0x800300FC (STG_E_INVALIDNAME))
Having trouble getting this too work.
I've downloaded the ole file property reader linked at the bottom of the page. I registered the dll using regsvr32, but errors are being returned.
Dim filename as string="c:\test\test.doc"
Dim dso As DSOFile.OleDocumentProperties
' returns error "DSOFile.OleDocumentProperties not defined"
dso = New DSOFile.OleDocumentProperties
' returns error "DSOFile.OleDocumentProperties not defined"
dso.Open(filename.Trim, True, DSOFile.dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess)
' returns error "DSOFile not declared"
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)
How do I use this library after downloading it?
This thread is for discussions of Retrieving the Summary properties of a file.