ServerAction: Store document from url in Database
Question
Application Type
Reactive
Service Studio Version
11.11.15 (Build 48647)

During a migration, i want to transfer Documents from an URL (SharePoint Attachment) into our Database. 

I cannot manage to download BinaryData in a Server Action. I tried to use the REST Integration and set the OutputParameter to Binary, but i get a 404 (just as in Postman, when i try to download the File via REST).

When i use "Send and download" in Postman, it works. So i think i just need a Server Action that just creates a HTTP Get Request to the url.

The Migration contains about 2000 Files, so i put everything into Server Actions.

Solution

Thank you! THAT question made me think again and check all different possibilities how to get to the file.

FInally, i managed it. The URL to fetch the binary file is now:

..._api/Web/GetFileByServerRelativePath(decodedurl='SOMEFILEURL')/$value 


Hi @Kevin Busch ,

You have this forge action that downloads a file (Binary) from a URL. Maybe it can help you.

https://www.outsystems.com/forge/component-overview/2763/binarydownload


Regards,

Luis Oliveira

Thank you for that idea!

Unfortunately we are not allowed to install new Stuff on that system, we are working on for this project.
But i looked into it, and it seemed to be a possible solution.

I managed to download the file now (https://www.outsystems.com/forums/discussion/73105/serveraction-store-document-from-url-in-database/#Post299132)

Hi,

you should take a look at the Sharepoint Forge Components for Sharepoint Integration. When using the REST api, you need to first retrieve an access token and then download the file.

Best

Stefan

Thank you, all other REST requests work well. Just the Binary Transfer does not work.
The bearer token is sent with each request.

Is that an Attachment to a List Item or from a document library ? Can you provide your oml or describe how you query the api and then download the file ?

Solution

Thank you! THAT question made me think again and check all different possibilities how to get to the file.

FInally, i managed it. The URL to fetch the binary file is now:

..._api/Web/GetFileByServerRelativePath(decodedurl='SOMEFILEURL')/$value 


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