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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Need help with - how t...
Power Pages
Unanswered

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,429 Super User 2025 Season 2 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,429 Super User 2025 Season 2 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard