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.
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.
Thanks. You are awesome 😎
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.
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?
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.
Fubar
69
Super User 2025 Season 1
oliver.rodrigues
49
Most Valuable Professional
Jon Unzueta
43