Show/Hide Toolbars

The following samples show how to read documents. Note that certain properties you can request to be returned are only relevant to particular document types (for example, the url property is only relevant to the document type, hyperlink). Comments are provided for properties that are document type-specific.

Code Snippet

private List<String> getPropertiesToRead() {

List<String> props = new List<String>();

//the list of all available properties displays below but to increase efficiency in your searches, you can omit unnecessary properties from your application and those values will not be returned

props.add("version");

props.add("subject");

props.add("categories");

props.add("createdOn");

props.add("createdBy");

props.add("modifiedBy");

props.add("modifiedOn");

props.add("name");

props.add("author");

props.add("authorDate");

props.add("size");

//the contentType is only relevant to a document of type FILE

props.add("contentType");

//the contentType is only relevant to a document of type FILE

props.add("content");

props.add("type");

props.add("parentFolder");

props.add("checkedOutBy");

props.add("checkedOutOn");

props.add("checkedInBy");

props.add("checkedInOn");

props.add("versionText");

//the url is only relevant to a document of type HYPERLINK

props.add("url");

//the contentType is only relevant to a document of type SHORTCUT

props.add("shortcutToDocument");

return props;

}

private Document readDocument() throws Exception {

Document readDocument = documentRepository.readDocument(uniqueKey,

getPropertiesToRead());

return readDocument;

}