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

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Sending Power App Atta...
Power Apps
Unanswered

Sending Power App Attachment to SharePoint List via Flow - The Flow runs as 'Success' but no file upload.

(0) ShareShare
ReportReport
Posted on by

Hi,

 

I have a SharePointIntegration App and I have created 2 screens each with a Form. When I have entered all the data in the 2 forms I navigate to the last page which allows me to upload an attachment like so;

PowerApps_Attachment1.PNG

I stripped out the attachment option from a Form and pasted it into a blank screen with a submit button (I believe this is the best way to get things working)

 

The OnSelect property of the submit button consists of the following;

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

//Following code converts attachment to binary format so that it can be stored in SharePoint

 

Set(varDemoFromAttachmentControl, JSON(Image2.Image, JSONFormat.IncludeBinaryData));
Set(varBase64Only, Mid(varDemoFromAttachmentControl, Find(",", varDemoFromAttachmentControl)+1, Len(varDemoFromAttachmentControl) - Find(",", varDemoFromAttachmentControl) -1));

 

//following code patches to a SharePoint List

 

Patch(
         'SharePointList 1',
         {
                   //Lots of inputs/comboboxes etc
         }
);

 

//Following code patches to another SP List and the ID of the item created is stored in 'MyCollection'

 

ClearCollect(MyCollection,Patch(
          'SharePointList 2',
           Defaults('SharePointList 2'),
           {
                     //lots of inputs/comboboxes etc
           }
));

 

//Following code calls Power Automate Flow called 'CR_Attachments' and passes the recently created List item ID, the name of the attachment uploaded, and the contents of the attachment in Binary format

 

CR_Attachments.Run(First(MyCollection).ID, Last(Attacher.Attachments).Name, varBase64Only);

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

 

The submit action works and both SP lists are updated correctly and the 2nd SP list shows an attachment icon. The Item ID (in this example '39') is clearly getting passed to the flow and trying to add the attachment;

PowerApps_Attachment2.png

However, when I go into the item there is no attachment. I checked the Flow and all seems to be working;

 

PowerApps_Attachment_3.png

I'm thinking it's something to do with the file content and how it is getting sent across. Any help appreciated.

Thanks

Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    52,972 Super User 2025 Season 2 on at
    Re: Sending Power App Attachment to SharePoint List via Flow - The Flow runs as 'Success' but no file upload.

    Hi @Marty3012 

     

    I would really suggest swapping to the Power Apps V2 and passing this stuff as named parameters.

    But File content is not simply content, its a record (called file: { }) and has the name and content inside it


    If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey 

  • WarrenBelz Profile Picture
    152,847 Most Valuable Professional on at
    Re: Sending Power App Attachment to SharePoint List via Flow - The Flow runs as 'Success' but no file upload.

    @Marty3012 ,

    Where is your base64ToBinary conversion of the JSON to send it back into binary image content (example in this blog of mine)

  • Marty3012 Profile Picture
    on at
    Re: Sending Power App Attachment to SharePoint List via Flow - The Flow runs as 'Success' but no file upload.

    I should have mentioned that the files I am trying to upload are pdfs, word etc and not images. My example uses code from one of Shane Young's example where you create an image control on a blank screen and use it to help process text files. 

     

    Also, I noticed in one of your examples for attachments that you use one drive for saving the file and then uploading to SP. I've used this method before but it only works if I myself upload a file, but when other users upload they come stuck as they don't have permissions to access the file once it is on one drive. Is placing it in the Root folder the way to go?

  • WarrenBelz Profile Picture
    152,847 Most Valuable Professional on at
    Re: Sending Power App Attachment to SharePoint List via Flow - The Flow runs as 'Success' but no file upload.

    @Marty3012 ,

    The file type is irrelevant - you need to convert the JSON string to Binary in the Flow with base64ToBinary. You also do not need to use OneDrive - the output of the conversion can be used as the Content of the Attachment.

  • Marty3012 Profile Picture
    on at
    Re: Sending Power App Attachment to SharePoint List via Flow - The Flow runs as 'Success' but no file upload.

    Hi @FLMike 

     

    I changed the code at the end of the OnSelect Button to the following;

     

    CR_Attachments_PA.Run(First(MyCollection).ID, Last(Attacher.Attachments).Name,
    {
    contentBytes: varBase64Only,
    name: First(Attacher.Attachments).Name
    }

    );

     

    I'm referring to the file name twice in the code above, but that was the only way I could remove any errors. I also updated my Flow using Power Apps V2;

     

    PowerApps_Attachment_4.png

    When I submit all works and the flow is a 'Success' and all the items are created in the Share Point list, apart from the attachment. I still see the attachment icon but no file. Would you know how to correct the file content that is being sent across? Thanks

  • Marty3012 Profile Picture
    on at
    Re: Sending Power App Attachment to SharePoint List via Flow - The Flow runs as 'Success' but no file upload.

    I changed the OnSelect Submit button to the following (end of code)

     

    CR_Attachments.Run(First(MyCollection).ID, Last(Attacher.Attachments).Name, varBase64Only);

     

    I then changed the Flow to the following;

     

    PowerApps_Attachment_5.png

    Still get the same result but I think I'm going in the right direction. Thanks

     

     

  • WarrenBelz Profile Picture
    152,847 Most Valuable Professional on at
    Re: Sending Power App Attachment to SharePoint List via Flow - The Flow runs as 'Success' but no file upload.

    @Marty3012 ,

    Please choose one direction or the other here - they both should work with the correct code, but three-way conversations do not assist anyone.

  • Marty3012 Profile Picture
    on at
    Re: Sending Power App Attachment to SharePoint List via Flow - The Flow runs as 'Success' but no file upload.

    Apologies for the confusion. I'm now going with Power Apps instead of Power Apps V2. Like you said, both ways should work as the code is correct and I'm pretty sure on my side it is working as I get the file attachment icon with the SPL item Attachment column. I did a bit of digging and checked the 'Add Attachment' action in the successful Flow;

     

    PowerApps_Attachment_6.png

     

    There appears to be gaps/spaces in the AbsoluteUri unlike in the ID path where there are special characters replacing the spaces. I think this is why the file is not saving to the list. Just not sure if there is a way to add the relevant special characters to the Uri so it works. Thanks

  • WarrenBelz Profile Picture
    152,847 Most Valuable Professional on at
    Re: Sending Power App Attachment to SharePoint List via Flow - The Flow runs as 'Success' but no file upload.

    @Marty3012 ,

    I use the Base64 method as I posted - @FLMike  can help you with Power Apps V2

  • Marty3012 Profile Picture
    on at
    Re: Sending Power App Attachment to SharePoint List via Flow - The Flow runs as 'Success' but no file upload.

    I was using the Base64 method for the file content., as shown below;

    PowerApps_Attachment_7.png

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard