Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - General Discussions
Answered

Need help with - how to upload Document using Web API in sharepoint site

(0) ShareShare
ReportReport
Posted on by 195

Hi everyonw,

 

I need a help with how to upload Document using Web API in sharepoint site using a HTML CSS JS form I created in Power pages site.

Categories:
  • swaminawale Profile Picture
    195 on at
    Re: Need help with - how to upload Document using Web API in sharepoint site

    Thanks. You are awesome 😎

  • Verified answer
    Lucas001 Profile Picture
    2,212 Super User 2025 Season 1 on at
    Re: Need help with - how to upload Document using Web API in sharepoint site

    Hi @swaminawale,

     

    if you use a cloud flow it's not necessary to use HTTP, there is a new trigger if you just type in power page in power automate. In your page you will have to setup the flow action within your javascript file.

     

    A sample code is listed at the end of that link: https://learn.microsoft.com/en-us/power-pages/configure/cloud-flow-integration.

    You can also get a HTTP response if you use the action: Respond to PowerPage

    shell.ajaxSafePost({
     type: "POST",
     contentType: "application/json",
     url: "_api/cloudflow/v1.0/trigger/44a4b2f2-0d1a-4820-bf93-9376278d49c4",
     data: JSON.stringify({"eventData":JSON.stringify({"Email": "abc@contoso.com", "File":{"name":"Report.pdf", "contentBytes":"base 64 encoded string"} })}),
     processData: false,
     global: false
     })
     .done(function (response) {
     
     })
     .fail(function(){
     
     });

     

    --------------------------------------------------------------------------------------

    Hope that helps.

    If the post solves your problem, please mark it as solution. If it helps, consider a thumbs up.

  • swaminawale Profile Picture
    195 on at
    Re: Need help with - how to upload Document using Web API in sharepoint site

    @Lucas001 

     

    Is the webapi really necessary here? YES

     

    So, If I use cloud flow then I need to use HTTP action right? to send POST request, then it will add a document to Sharepoint,

     

    Correct?

  • Lucas001 Profile Picture
    2,212 Super User 2025 Season 1 on at
    Re: Need help with - how to upload Document using Web API in sharepoint site

    Hi @swaminawale,

     

    is the webapi really necessary here?

    If not and you have some settings checked in the background I would recommend using a cloud flow and embed this into your power page. It's easier to handle. A fast introduction is available here: https://learn.microsoft.com/en-us/power-pages/configure/cloud-flow-integration

     

    This would be the approach if you directly want to upload to sharepoint via REST: https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/upload-a-file-by-using-the-rest-api-and-jquery



    --------------------------------------------------------------------------------------

    Hope that helps.

    If the post solves your problem, please mark it as solution. If it helps, consider a thumbs up.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 69 Super User 2025 Season 1

#2
oliver.rodrigues Profile Picture

oliver.rodrigues 49 Most Valuable Professional

#3
Jon Unzueta Profile Picture

Jon Unzueta 43