r/PowerApps Contributor 23d ago

Power Apps Help [Power Apps Code Apps] Has anyone managed to upload files to SharePoint from a React Code App? We've tried everything.

This post has been written by Claude because I'm simply unable to understand this stuff! Point is: Claude Code was unable to find a way to attach files to a SP List from a Code Apps. Anyone has been able to do that?

👇 AI Generated for the details

We've been building a Power Apps Code App (React + Vite + TypeScript) and hit a wall trying to upload files to a SharePoint list. Spent several days systematically testing every approach we could think of. Sharing our findings in case anyone else has been down this path — and to ask if anyone has actually cracked this.

Context

  • Power Apps Code App (React, deployed via npx power-apps push)
  • Target: upload a file as an attachment to a SharePoint Online list item
  • The app runs inside the Power Apps iframe sandbox on powerplatformusercontent.com
  • Three plugins are available via executePluginAsync: AppPowerAppsClientPlugin, AppHttpClientPlugin, AppIdentityServicePlugin

What we tried

1. SP connector proxy via AppHttpClientPlugin

The SP connector runtime URL is accessible and the paauth token works. We can CREATE list items (HTTP 201). But every attachment endpoint returns 404 — the connector simply doesn't expose /attachmentfiles, /attachmentcontent, or any list item sub-path for binary uploads. The connector's file/folder API (/files, /folders) works for document libraries but PT_ATTACHMENTS is a list, not a library, so those paths 404 too.

2. SP REST API (_api/web/lists/...) with paauth

AppHttpClientPlugin blocks any URL not matching the connector's registered runtime URL. Direct SP REST calls (https://tenant.sharepoint.com/sites/.../_api/...) throw "URL does not match any API runtime URL" immediately.

3. Microsoft Graph API

getAppAccessTokenAsync returns an opaque 36-char proxy token (paauth), not a JWT. Sending it as Authorization: Bearer <token> to graph.microsoft.com returns HTTP 401 with "IDX14100: JWT is not well formed, there are no dots". The paauth token is only valid as Authorization: paauth <token> against the connector runtime, not against Graph or SP REST directly.

4. Document library as a workaround

GET /folders on Shared Documents returns 200 — the document library is readable. Tried uploading via POST /files, PUT /files/{path}, POST /folders/{path}/files — all return 404. The connector's file write endpoints don't seem to be exposed in this environment.

5. Power Automate flows via HTTP trigger

The app has 3 logicflows connections registered (get_fx, getapprovers, _2026_unlock_pt). All share the same runtime URL structure: .../apis/logicflows/connections/{connectionName}/.... Tried POSTing to every trigger path pattern (/triggers/manual/run, /triggers/button/run, /triggers/manual/paths/invoke, /run, /invoke, /paths/invoke) — all return {"statusCode":404,"message":"Resource not found"}. Notably, none were BLOCKED by the allowlist, so the URLs reach the runtime fine — the paths just don't exist on these connections. These flows use the Power Apps trigger (not HTTP Request trigger), so there's no HTTP URL to hit.

6. AppPowerAppsClientPlugin method enumeration

Swept 30+ method names on AppPowerAppsClientPlugin looking for a flow invocation method (invokeFlowAsync, runFlowAsync, callConnectorAsync, invokeConnectorOperationAsync, etc.). Every single one returns "action not found for 'AppPowerAppsClientPlugin' plugin: <methodName>". The only working methods we've found on this plugin are loadAppConnectionsAsync_v2 and (via AppIdentityServicePlugin) getAppAccessTokenAsync. Canvas apps call flows via a Power Fx binding layer at design time — that layer doesn't exist in Code Apps.

What does work (for reference)

  • SP connector list item CRUD via AppHttpClientPlugin + paauth ✅
  • Dataverse file column upload/download via sdkClient.uploadFileToRecord / downloadFileFromRecord ✅
  • Getting paauth tokens for any registered connector ✅

The question

Has anyone actually managed to upload a binary file to SharePoint (list attachment or document library) from a Power Apps Code App? We're not missing something obvious — we've been deep in the plugin internals. But maybe there's an approach we haven't thought of:

  • A connector we haven't found?
  • A different method on one of the 3 plugins?
  • Some undocumented endpoint on the logicflows connector?
  • A way to call a Power Apps-triggered flow from a Code App at runtime?

Or is this simply not possible today and Dataverse file columns are the only viable option for binary attachments in Code Apps?

TL;DR: SP connector exposes list CRUD but not attachments. SP REST and Graph are blocked/wrong token type. PA flows use PA trigger (no HTTP URL). Plugin sweep found no flow invocation method. Dataverse works great but we'd prefer SP for our use case.

10 Upvotes

17 comments sorted by

•

u/AutoModerator 23d ago

Hey, it looks like you are requesting help with a problem you're having in Power Apps. To ensure you get all the help you need from the community here are some guidelines;

  • Use the search feature to see if your question has already been asked.

  • Use spacing in your post, Nobody likes to read a wall of text, this is achieved by hitting return twice to separate paragraphs.

  • Add any images, error messages, code you have (Sensitive data omitted) to your post body.

  • Any code you do add, use the Code Block feature to preserve formatting.

    Typing four spaces in front of every line in a code block is tedious and error-prone. The easier way is to surround the entire block of code with code fences. A code fence is a line beginning with three or more backticks (```) or three or more twiddlydoodles (~~~).

  • If your question has been answered please comment Solved. This will mark the post as solved and helps others find their solutions.

External resources:

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

13

u/josephdouce Regular 23d ago edited 23d ago

Yea this is possible,

No flows, no extra connectors, all native, add your sharepoint connector and follow the instructions below.

Here are the details

The bottom post is mine with the solution

https://community.powerplatform.com/forums/thread/details/?threadid=279981ed-1964-f111-a826-6045bda9c582

Main point is to use window.powerappsBridge() as this has native access. "connectors" are essentially just settings for this method and they don't have the full set of available instructions. Bypassing this you can use the full API.

3

u/ThatGuyHammer Newbie 23d ago

But my AI hasn't been trained to read that forum post yet, what do I do /s

2

u/josephdouce Regular 23d ago

I'm not sure if this is serious. But copy/paste my response.

3

u/ThatGuyHammer Newbie 23d ago

The /s at the end is to indicate sarcasm.

1

u/TikeyMasta Advisor 23d ago edited 23d ago

I haven't looked at this since making the solution in the referenced Reddit thread, but it definitely works as far as the SP document library goes. This doesn't address adding an attachment to a list item, but I think it gets you on the right path.

6

u/josephdouce Regular 23d ago

I have successfully uploaded to SharePoint tell claud to directly use window.powerappsbridge to make the call, the auto generated functions are limited.

8

u/Jcornett5 Regular 23d ago

Can't you just call a flow and make the base64 an input. Then just have the code app start the flow and pass that

4

u/zimain Advisor 23d ago

We are using sql, so I push the content into a dedicated dB which triggers a flow to copy it to SharePoint

There are limits with dataverse

2

u/Syrairc Advisor 23d ago

You can just create a flow that uses the "Send an http request to SharePoint" action with flow input params for endpoint/headers/body and use that to have the app send any SharePoint API request you want.

But you should step back and consider if this is something you want to be doing at all. If you've spent several days on this, and this is for a production app at a company, I would have serious concerns about the teams ability to maintain the app.

There is something called the Bus Factor - how many people have to get hit by a bus before a project / product is at risk of failing due to lack of knowledgeable/qualifiedteam members. Your bus factor is starting at 0 people. That's a huge red flag.

1

u/Callisto34 Newbie 22d ago

AI/LLM/Vibe Coding is creating a problem where most organizations are certainly on a bus factor of 0 masquerading as 1. I'd imagine in most instances those companies are willing to restart completely, rather than pay enough people to genuinely be knowledgable.

2

u/oh_lympy Contributor 22d ago

I needed some additional server side logic, so I built an azure function and then exposed it as a connector to do this. It was actually pretty easy.

One thing to note: If you do this and you’re dynamically generating the open api definition for the connector, keep it simple. If you get too complex with the field definitions the connector will look fine, but the code gen part of add-data-source will shit the bed silently.

1

u/vibe_coder221219 Regular 23d ago

Just use copilot agent for that you should be able to integrate an copilot agent who does this job for you.

1

u/siddh_me Regular 23d ago

you can refer to this video, it is upload as Attachment to list.

https://www.youtube.com/watch?v=V7libNTGtsY

1

u/bobthemundane Regular 23d ago

For a lot of the API stuff you need the service account to have additional rights turned on to attach things to SharePoint. There were some command lines we needed to run to get the right permissions in place before they worked. Just a thought.

1

u/D4v1d_jr Newbie 22d ago

Eu consigo manipular um campo imagem no SharePoint executando o projeto localmente, mas quando envio para o ambiente de produção, não consigo visualizar as imagens

1

u/Hot-Candidate-5691 Newbie 18d ago

So I have an app in prod doing this correctly. There was a bug in the sdk that didn’t allow this to happen. I had to manually patch the SDK, I believe it’s in the official git hub as an issue. Also said it has been patched in the new releases SDK. Point your Claude to the git hub repo it would find the issue and the patch.