OpenDocuments.ViewDocument Method

Applies to: SharePoint Foundation 2010

Opens the document for reading instead of editing, so that the document is not locked on the server.

expression.ViewDocument(bstrDocumentLocation, varProgID)



An expression that returns an OpenDocuments Control object.


A string that contains the URL of the document to open for reading.


An optional string that contains the ProgID of the application with which to open the document. If this argument is omitted, the default viewer for the document is used.

Return Value

true if the document was successfully opened; otherwise false.


Use the ViewDocument method to open a document in its appropriate application, instead of inside of an application instance embedded within the browser.