Is there Java/SSJS equivalent of @AttachmentModifi

2019-07-23 23:20发布

问题:

I want to show list of attachments and FileDownload control is not an option (need custom actions for every file).

To get name and size of attachments there are properties of EmbeddedObject. AFAIK, to get modified time of attachment there is only one option: to use pure @Formula, either via session.evaluate or view containing column with @AttachmentModifiedTimes.

Is there a way (Java/SSJS) to get attachment's modified (and created) time without native @Formulas? That means date stored with file shown in document properties for $FILE item.

回答1:

You can add a Repeat Control to the page and bind that to the attachments (stored in a rich text field) using document1.getAttachmentList("rt_field_name"). Every item in that list is an object of class

com.ibm.xsp.model.domino.wrapped.DominoDocument$AttachmentValueHolder

That class has a getLastModified() method that returns the last modified time as a Double.

A couldn't find a reference on the web showing the full API, but if you use the API Inspector in the XPage Debug Toolbar (sorry for the shameless plug...) you can view all properties and methods using:

getComponent( 'id_of_repeat_control' ).getDataModel().getRowData()

UPDATE

Found the API here,



回答2:

I am not 100% sure what you want to achieve. In general you can use @AttachmentModifiedTimes() - as well as @AttachmentNames() - as SSJS.