Search code examples
downloadxpagesattachmentxpinc

XPINC launch an attachment instead of downloading it


Is there a way to launch (open without saving) an attachment through XPINC? Something like the popup in web browser that ask you whether to open the attachment using a program or just save it first. Or maybe there's some setting in the notes client that I've yet to found that will launch an attachment?

I tried to built my own file download control so that I can built the URL to directly launch the attachment. It consist of a repeat control bounded to the attachment field and just a link control within it with URL computed as curRow.getHref()

And that worked fine but still it ask for me to save instead of launching the attachment directly. Changing the above code to curRow.getHref() + "?Open" also yield the same result. Any workaround?


Solution

  • The only way that I could find to do this was to construct a notes url that opened a conventional Notes form that had the launch property "Launch First Attachment" and only a single attachment.

    It worked well but is obviously limited to documents with a single attachment. It also prevents the form from being opened as xpages by default but that is usually manageable.

    You could construct documents on the fly and open them but that seems rather clumsy.

    This is the formula for my XPage link in a repeat

    var repIDVar = database.getReplicaID();
    "notes://"+@Name("[CN]",@Subset(@DbName(),1))+"/"+repIDVar+"/0/"+rowData.getUniversalID()