I have binary files (of an MS Word document) stored in an OutSystems data entity, and I want the user to be able to open the file directly in MS Word by clicking on a link. Do database records have a URL? My first idea is to use a URI schema in the link, but I need a URL for the file.
I have already tried another option, which was to create a REST service which returns the binary, and use the link to the REST service with an URI schema. However this did not work.
Any suggestions would be appreciated! Thank you.
The only way of doing this would be via a REST service. What did not work when you were trying it?
First I formatted the link to the REST endpoint, with a URI Schema at the beginning to open MS Word. Like this:
ms-word:ofv|u|https://personal-zzz.outsystemscloud.com/RESTbinarytest/rest/OpenBin/GetBinary?FileID=1
When clicking on the link, I get the prompt from the browser to allow opening MS Word. However, then I get an error message. Screenshot is in German but it means that "Office does not recognize the command."
I can eliminate the URI schema and download the file as a Word document, but if possible I would like to open Word directly
Hi Britta,
I have recently written a Medium article for exactly that problem. Creating a REST service is indeed the way to go, but you need some extra stuff to make it work.
Thank you! I have followed the steps from your tutorial. My REST service was missing the HTTP headers. Now I can download the binary as a Word document. However, opening directly with a URI schema does not work. Maybe it isn't possible? (See my reply to the other comment for the screenshots of the error messages)
Have you used the right MIME type for Word documents? It's "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
Hi Kilian, yes that is the Content Type I am using for the .docx files.