web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Need help with - how t...
Power Pages
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:
I have the same question (0)
  • Lucas001 Profile Picture
    2,575 Super User 2026 Season 1 on at

    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.

  • swaminawale Profile Picture
    195 on at

    @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?

  • Verified answer
    Lucas001 Profile Picture
    2,575 Super User 2026 Season 1 on at

    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

    Thanks. You are awesome 😎

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
sannavajjala87 Profile Picture

sannavajjala87 38 Super User 2026 Season 1

#2
Valantis Profile Picture

Valantis 35

#3
Fubar Profile Picture

Fubar 23 Super User 2026 Season 1

Last 30 days Overall leaderboard