Click here to Skip to main content
13,294,840 members (72,580 online)
Click here to Skip to main content
Add your own
alternative version


19 bookmarked
Posted 22 Jun 2005

View/Modify Office File Properties using OLE

, 22 Jun 2005
Rate this:
Please Sign up or sign in to vote.
This article allows to view/modify the file summary properties.

Sample Image - DSOFileDemo.gif


In one of my projects, I wanted to send additional information with file like version history, created by, approved by, etc. when my files are viewed by my users in offline mode (they have downloaded the files from Intranet and read it) without using any external data repository like XML/TXT. So I thought utilizing the summary tab of files and it will not require any external data repository.

As per my application requirement, I just had to work with .DOC, .XLS and .PPT files, so I used the DSO to perform this task.

Using the code

This is a simple code snippet which fetch the file information, and update it once you have modified the information. Here is code which does the core work:

private DSOFile.OleDocumentPropertiesClass myDSOOleDocument = 
    new DSOFile.OleDocumentPropertiesClass();
* Opening file 
* ***************************************************/ 
myDSOOleDocument.Open(openFileDialog1.FileName,false , 

* Reading from file through DSO and writing values to form 
* ***************************************************/ 
txtTitle.Text = myDSOOleDocument.SummaryProperties.Title; 
txtSubject.Text = myDSOOleDocument.SummaryProperties.Subject; 
txtAuthor.Text = myDSOOleDocument.SummaryProperties.Author; 
txtCategory.Text = myDSOOleDocument.SummaryProperties.Category; 
txtKeyword.Text = myDSOOleDocument.SummaryProperties.Keywords; 
txtComment.Text = myDSOOleDocument.SummaryProperties.Comments ;

* Reading from form and writing values to File summary through DSO 
* ***************************************************/ 
myDSOOleDocument.SummaryProperties.Title = txtTitle.Text; 
myDSOOleDocument.SummaryProperties.Subject = txtSubject.Text; 
myDSOOleDocument.SummaryProperties.Author = txtAuthor.Text; 
myDSOOleDocument.SummaryProperties.Category = txtCategory.Text; 
myDSOOleDocument.SummaryProperties.Keywords = txtKeyword.Text; 
myDSOOleDocument.SummaryProperties.Comments = txtComment.Text; 

Points of Interest

I was able to provide user friendly search without even opening file, just with the help of DSO. This can be a straight forward approach to create small knowledge base too.


Initial version added on 23 June, '05.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Vivek Singh - IN
Web Developer
India India
No Biography provided

You may also be interested in...


Comments and Discussions

QuestionUsing the DLL on opened file Pin
Carsten Giesen12-Dec-14 3:41
memberCarsten Giesen12-Dec-14 3:41 
GeneralUsing IPropertyStorage Pin
rdkcds16-Feb-10 3:44
memberrdkcds16-Feb-10 3:44 
GeneralUnauthorizedAccessException Pin
chawkins125-May-07 7:24
memberchawkins125-May-07 7:24 
GeneralRe: UnauthorizedAccessException Pin
Vivek Singh - IN25-May-07 16:29
memberVivek Singh - IN25-May-07 16:29 
QuestionWhat about non-office files? Pin
vaximillian15-Feb-07 9:38
membervaximillian15-Feb-07 9:38 
AnswerRe: What about non-office files? Pin
Vivek Singh - IN18-Feb-07 19:10
memberVivek Singh - IN18-Feb-07 19:10 
GeneralRe: What about non-office files? Pin
vaximillian23-Feb-07 0:07
membervaximillian23-Feb-07 0:07 
GeneralRe: What about non-office files? Pin
S. Calistio28-Jul-07 6:48
memberS. Calistio28-Jul-07 6:48 
Generalsmall help Pin
samasavinirs6-Mar-06 23:43
membersamasavinirs6-Mar-06 23:43 
GeneralBeware using wrong version of DSOFile.DLL Pin
gxdata22-Jun-05 23:06
membergxdata22-Jun-05 23:06 
GeneralRe: Beware using wrong version of DSOFile.DLL Pin
Vivek Singh - IN22-Jun-05 23:18
memberVivek Singh - IN22-Jun-05 23:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171207.1 | Last Updated 23 Jun 2005
Article Copyright 2005 by Vivek Singh - IN
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid