40
Views
6
Comments
Can database records be reached by a URL? (to open binary file directly in MS Office)

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.

2022-11-16 10-07-10
Blane Thompson

The only way of doing this would be via a REST service. What did not work when you were trying it?

2023-06-06 12-48-13
Britta Waldbauer Kimilli

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


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

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.

2023-06-06 12-48-13
Britta Waldbauer Kimilli

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)

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Britta,

Have you used the right MIME type for Word documents? It's "application/vnd.openxmlformats-officedocument.wordprocessingml.document"

2023-06-06 12-48-13
Britta Waldbauer Kimilli

Hi Kilian, yes that is the Content Type I am using for the .docx files.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.