cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Form Upload Error

I can't fix what's broke. Any ideas?

 

I get error message: Invalid number of arguments: received 5, expected 2 ' when I hover over the expression. Its my attempt at forcing the name of the file on the SP side to 'UnqID-CQYr-CQTitle'. That way the member can call it whatever they want and it won't impact query and filter on the database side while allowing the file to be recognizable to the eye in the library. 

 

Set(varFileLink, CertsQualsUploader.Run(Last(DataCardValue44.Attachments).Name, varBase64Only,Value(DataCardValue11.Text),DataCardValue7.Text,NewCQFormTitleDD.Selected.ClassTitles).sharepointfilelink);

 

FullNm:LookUp(SFPrgrmMmbrsCollection,UnqID=DataCardValue7.Text).UnqID,CQYr:Value(DataCardValue11.Text),NewCQFormTitleDD.Selected.ClassTitles

 

The system will take this edited version just fine - 

 

Set(varFileLink, CertsQualsUploader.Run(Last(DataCardValue44.Attachments).Name, varBase64Only).sharepoinfilelink);

 

Any thoughts?

15 REPLIES 15
v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

Could you please share a bit more about your flow's configuration?

 

Regarding the error that you mentioned, it seems that there is something wrong with the parameter values specified in your  CertsQualsUploader.Run() function.

 

From the error message that you mentioned, it seems to tell that the CertsQualsUploader.Run() function needs to receive two argument value, but you provided 5 arguments values in your first CertsQualsUploader.Run() function.

 

If you want to pass 5 arguments from your canvas app to your flow, you need to define these 5 parameters in your flow firstly, and then you could provide proper value for these defined parameters through the CertsQualsUploader.Run() function in your canvas app.

Note: You may need to re-create a new connection to your flow from your canvas app to make the parameter changes you made in your canvas app.

 

More details about firing a flow from a canvas app, please check the following video resource:

https://www.youtube.com/watch?v=1wl9AtxWdkg

 

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.
Anonymous
Not applicable

Yep. Thanks! I rewrote and reattached and got it working.

 

Thank you!

 

If I may, currently the uploaded file is named whatever the owner named it. 

 

In SP designer I was able to force a naming convention through the flow so that the file, once inside the environment, was named what we needed it to be named.

 

I believe such a thing is possible in automate, by using the 'editing the expression' in the flow. I had it working, by accident. Now I don't remember how I did it. Any thoughts?

 

The naming convention once uploaded to the SP library by the flow should be UnqID-Title-Yr; (all fields are available in the list).

Hi @Anonymous ,

Do you want to rename the file created in your SP Library?

 

Regarding the needs that you mentioned, I think the Work Flow Definition Language expression in Power Automate Flow could achieve your needs. If you want to concatenate multiple field values from your SP List to make the file name, I think the concat expression could achieve your needs:

1.JPG

Set the File Name field to following expression:

concat(outputs('Get_item')?['body/Department'], '-',outputs('Get_item')?['body/DueDate'], '.jpg')

Note: The '.jpg' represents the file extension name, you should change it to meet your needs.

 

Please try above solution, then check if the issue is solved.

 

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.
Anonymous
Not applicable

I made the change and got this....

The response from API 'sharepointonline' operation 'GetTable' with status code '200' does not contain a valid OpenAPI schema object.

 

Flow Looks Like -

 

1. PowerApps Trigger

 

2, Get Item

 

Site: https://powerapps... 

List Name: Default-.../apps

Id: Get item_Id

 

3. Create file

 

Site: https://sharepoint

 

Folder Path: Desired library

 

File Name: concat(outputs('Get_item')?['body/UnqID'], '-',outputs('Get_item')?['body/DteofAwrd'], '-',outputs('Get_item')?['body/CQTitle'])

 
File Content:  base64ToBinary(triggerBody()['Createfile_FileContent'])
 
4. Respond to a PowerApp of Flow
 
SharePointFileLink: https.... Path

Hi @Anonymous ,

Could you please share more details about your issue?

Could you please share a screenshot about your flow's configuration?

 

Regarding the expression value you specified within the File Name field and File Content field of the "Create file" action, I think there is something wrong with it.

 

For File Name field in "Create file" action, you should append a file name extension into the concat expression, e.g.:

concat(outputs('Get_item')?['body/UnqID'], '-',outputs('Get_item')?['body/DteofAwrd'], '-',outputs('Get_item')?['body/CQTitle'], '.jpg')

If the CQTitle field value has already contains the file extension name, you could ignore above modified expression.

 

For File Content field of the "Create file" action, you should use dataUriToBinary() function to convert the base64 encode image data passed from your canvas app instead of the base64ToBinary() function. You should modify the expression as below:

dataUriToBinary(triggerBody()['Createfile_FileContent'])

 

Please check and see if my solution in the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/Building-Power-Apps/Upload-document-from-powerapps-to-sharepoint/td-p/667972

 

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.
Anonymous
Not applicable

In Power Apps you can create a Form and use the Form Attachment field (which only allow you to chose images), or you can 'steal' and attachment control from a form, clean it out and use it as the attachment. This allow you to attach any time of file; I chose this route.

 

I've seen the process work. I did it a month or so ago. I file appeared on the other end with UnqID-Yr-Title. I just need to remember or be told how to build the concat on the flow. 

 

 

Anonymous
Not applicable

Though what you suggest regarding the binary language may work, it was not the issue.

 

The base64Binary (or whatever I used) worked the first time.

 

I think I just need to figure out how to concatenate the pieces.

Hi @Anonymous ,

Yeah, you are right. Please check if the concat expression you used in your flow could return a proper file name including a File Extension Name.

 

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.
Anonymous
Not applicable

What I currently have is the following. It works fine; in that it will upload the document the User attaches to the library I desire. 

 

What it doesn't do is rename the file during upload.

 

I desire a concatenate formula that will, in place of the  'Createfile-FileName', use the Member's 'UnqID', 'CQTitle', and DteofCQ as the file name when the item is created in the SP library.

 

Capture 1.PNG

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,358)