cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MichelH
Level 8

file upload functionality towards a sharepoint document library

I’ve made an app to test file upload functionality towards a sharepoint document library, using a flow to create the file on sharepoint.

 

It went smooth and worked as expected, I tested two components to select the files, being an ‘attachments’ control, and a MediaButton control (it’s call ‘add picture’ in the GUI).  

 

pic1.pngpic2.png

 

Both buttons call the same flow called SendFileToFlow using the code below which stores the file on sharepoint.

 

 

Set(FilePath2, SendFiletoFlow.Run( 
    { file:
        { name: Last(Upload1.Attachments).Name
        , contentBytes:Last(Upload1.Attachments).Value 
    } } 
));

Set(FilePath1, SendFiletoFlow.Run( 
    {file: 
        { name:Upload.FileName
        , contentBytes:Upload.Media 
    }} 
));

 

 

pic3.png

 

I had a nasty surprise when I tried the same code in the production app. It doesn’t work.

 

Now whenever I copy this working code into a new app, in conjunction with the very same flow, I get this exactly the same error message for each control:

 

pic4.png

 

 

So now I’m trying to understand why code is right in one app and wrong in the other.

 

I would assume since the contentBytes ‘type’ in the upload is set by the control it must be the same in every app!

 

How can I troubleshoot this further?

 

Thanks for any response.

 

While browsing the forums I found someone suggesting to add an odata type to the statement.

 

pic5.png

It doesn't seem to help, but maybe I did not get it correctly.

 

Michel

 

 

In both the working and the failing case the control.Attachments.Name and the control.Attachments.Value of the attachments return this:

 

secretstuff.pdf 
appres://blobmanager/1c18e61fbcf34bc4a9dd9bfed5706806/1

 

5 REPLIES 5
Community Support Team
Community Support Team

Re: file upload functionality towards a sharepoint document library

Hi @MichelH ,

How many parameters specified within your flow? Two or single one?

 

Based on the error message that you mentioned, it seems to tell that you have missed a 'contentBytes' column within your SendFiletoFlow.Run(...) formula.

Please consider consider re-create a new conection to your flow from your app, then try your formula again, check if the issue is solved. Also please check if you have made some changes to your flow.

 

I have made a test on my side, and don't have the issue that you mentioned. Please consider re-configure your flow based on the following video resource:

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

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

 

I have made a test on my side, the flow's configuration as below:

1.JPG

The sample of my canvas app as below (see the attached .msapp file):

2.JPG

 

Please consider take a try with above sample app I provided, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MichelH
Level 8

Re: file upload functionality towards a sharepoint document library

Thank you @v-xida-msft ,

 

You can see the column contentBytes in the run statement, so powerapps is only unhappy about the datatype of the column, not being blob.

 

As said, if in one app this column type is fine, then I would expect it to be fine in another app, (using the same controls,) as well.

 

Can you explain or advise how to troubleshoot this? 

Thanks,

 

Michel

Community Support Team
Community Support Team

Re: file upload functionality towards a sharepoint document library

Hi @MichelH ,

Currently, I afriad that there is no direct way to troubleshot this issue. Please consider copy your flow, and then rename it as another name, then create a connection from your another app to this copied flow, then check if the issue is solved.

 

Have you taken a try to remove the flow connection in your app, and re-create a new one? If you export/import your original canvas app, the flow connection within this exported app would be invalid. Please consider remove the flow connection in your another app, then re-create a new one within your another app, check if the issue is fixed.

 

If the issue still exists, please consider take a try with the solution (sample app) I provided, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
MichelH
Level 8

Re: file upload functionality towards a sharepoint document library

Hi @v-xida-msft  Kris Dai,

 

I've exported and imported the powerapp package to another name. That 'just' works.

I noticed that, if I do a save-as of the flow SendFiletoFlow to SendFiletoFlow2 and try to connect the app to the other flow I already get the same error.

I know '100%' the app and the flow are the same, ..... or at least the part I can see. This tells me the issue is in the part under the hood. 

 

I think I will try to adapt Paul Culmsee's app and flow for my purposes and see how it goes.

Michel

MichelH
Level 8

Re: file upload functionality towards a sharepoint document library

Using the video of Paul Culmsee, as provided by @v-xida-msft  Kris Dai, I was able to build a working upload.

 

Michel

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (6,701)