Xpages Embedded Object - How to retrieve File Date of an Attachment

140 Views Asked by At

I have been able to loop through attachments and retrieve file names, but I would like to also retrieve files dates as well and cannot seem to find any documentation that shows how it can be done.

    if (attachDoc.hasItem("Attachments")){
        var attachment:NotesRichTextItem = attachDoc.getFirstItem("Attachments");
        
        if (attachment != null) {
            var eos:java.util.Vector = attachment.getEmbeddedObjects();
            if (eos.isEmpty()) {
                print("Attachments empty: no files do nothing");
            } else {
                //print("added attached");
                var e:Enumeration = eos.elements(); 
                while (e.hasMoreElements()) {
                    var eoA:EmbeddedObject = e.nextElement();
                    if(eoA.getFileSize() < 10000000){
                        print(eoA.getName());//this shows file names correctly
                        print(eoA.getFileDate());//this fails. Error calling method...
                    }else{
                        print("Unable to send the email. The file size is " + Math.round(eoA.getFileSize()/1000000) + "MB.");
                    }
                }
            }
        }
        attachment.recycle();
    }
    attachDoc.recycle();
}catch(e){
    print("error with attachment " + e.toString());
}

I will be grateful to receive your assistance.

1

There are 1 best solutions below

0
On BEST ANSWER

You can use

eoA.getFileCreated()

or

eoA.getFileModified()

Both return a string representing the date and time the file was created/last modified.