0

I am trying to use a SharePoint request action in Power Automate to upload a file to a library. I'm running into an issue that I've seen many others who have attempted this either using the SP JSOM or jquery/ajax calls in that any file other than a 'txt' is corrupt when uploaded.

Does anyone know how to properly use PowerAutomate to upload a file to SP with REST?

I am converting the my base64 string into binary via the base64tobinary() expression. Uri endpoints and headers are as follows:

    method: post
    uri: _api/web/lists/getbytitle('shareddocs')/RootFolder/files/add(overwrite=true,url='filename')
    headers:  {
    accept:  application/json; odata=verbose,
    content-type:  application/octet-stream
    }
    body:  base64tobinary('base64var')


1 Answer 1

1

Might not be the direct answer to your question, but it is probably easier to use the native "Create file" action instead of the REST:

enter image description here

3
  • Yes, if I could use the native I definitely would however I need my solution to be dynamic. Commented Apr 9, 2021 at 22:27
  • 1
    Create file is quite dynamic. every field here can be a variable Commented Apr 9, 2021 at 22:29
  • whoops sorry. i misread your reply. i’ll see if i can go this route. thanks! Commented Apr 9, 2021 at 23:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.