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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch - PowerApps to S...
Power Apps
Unanswered

Patch - PowerApps to Sharepoint using Power Automate: Invalid Number of Argument Received 1; Expected 2 or 3 .

(0) ShareShare
ReportReport
Posted on by 44

Hi All,

I am trying to use Power apps to collect submissions from user which includes multiple attachment and other text records.

I am using the below flow and Patch formulae but running into an error: 

Aashish_0-1704409759008.png

Set(
var12,
Patch(
'List',
Defaults('List'),
{ProjectName: PRName.Text},
{ProposedDate: Date.SelectedDate},
{ProjectType: DDPRType.Selected.Value}
)
);
Reset(PRName);
ForAll(
Attachment.Attachments As Document,
PowerAppsToSharepoint.Run(
{
file: {
contentBytes: Document.Value,
name: Document.Name
},
number: var12.ID
}
)
);
Notify("Thank you for submission");
Reset(Attachment)

Using this flow , I got an error saying ; Invalid Number of Argument Received 1; Expected 2 or 3 .
Also, I am unsure if the list ID I got in the flow is correct? I followed a video to achieve this.
Could I please get assistance?

Categories:
I have the same question (0)
  • AARON_C Profile Picture
    2,235 Most Valuable Professional on at

    Hi @Aashish 

     

    First of all your patch function is incorrect. The syntax for patch only requires one set of {} brackets.

    Patch('Data source', 
     Defaults('Data source'), 
     {
     Column1: TextInput1.Text,
     Column2: DatePicker1.SelectedDate,
     Column3: DropDown1.Selected.Value
     }
    ); 

     

    Please tick Accept as solution if the answer is useful.

    Thanks,

    @AARON_C 

  • Aashish Profile Picture
    44 on at

    Thank you for pointing @AARON_C 

    My issue lies in 

    ForAll(
        Attachment.Attachments As Document,
        PPWCPowerAppsToSharepoint.Run(
            {
        file: {  
                    contentBytes: Document.Value,
                    name: Document.Name
                },
                number: var12.ID
            }
        )
    );
    Notify("Thank you for submission");
    Reset(Attachment)
     
    where it is displaying an error saying less than 2 argument is receive. Could you assist with this?
  • AARON_C Profile Picture
    2,235 Most Valuable Professional on at

    @Aashish 

     

    I think you have an extra set of {} in your flow as well. Remove the outer {} wrapping the file and number.

    ForAll(
     Attachment.Attachments As Document,
     PPWCPowerAppsToSharepoint.Run(
     file: { 
     contentBytes: Document.Value,
     name: Document.Name
     },
     number: var12.ID
     )
    );

     

    This will give you 2 arguments.

  • Aashish Profile Picture
    44 on at

    I did try removing it but it still has the same error. Can you see any other possible fix?

  • AARON_C Profile Picture
    2,235 Most Valuable Professional on at

    @Aashish 

     

    You also need to add in your other inputs. The Text and Date inputs

  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    @Aashish ,

    I will add something here as you may need to understand a bit about what you have just written in order to duplicate it in the future. The fundamental issue is that you have requested two parameters (A Date and a Text value) that you have not used in the Flow (but it still expects them), but more importantly, you have hard-coded the ID in the Flow rather than sending it as a Parameter. You are also creating a new file in a separate Library to the attachment list item (not sure if you meant to do this). If you want to do all of this, your Flow would look like this

    NewItemAttach.png

    and your code like this

    Set(
     var12,
     Patch(
     'List',
     Defaults('List'),
     {
     ProjectName: PRName.Text,
     ProposedDate: Date.SelectedDate,
     ProjectType: DDPRType.Selected.Value
     }
     )
    );
    Reset(PRName);
    ForAll(
     Attachment.Attachments As Document,
     PowerAppsToSharepoint.Run(
     var12.ID,
     {
     file: 
     {
     contentBytes: Document.Value,
     name: Document.Name
     }
     }
     )
    );
    Notify("Thank you for submission");
    Reset(Attachment)

    I will leave you with @AARON_C to sort out anything else.

     

  • Aashish Profile Picture
    44 on at

    @WarrenBelz  : great explanation and I have now solved half of my problems.

    I want to achieve everything, add the document in a folder and add to list too. Now that I have edited my ID for for the Add Attachment action, all other records in sharepoint are being updated except for the attachment.

    A new file is being created but it is not being added in sharepoint. Is it because of the column type in sharepoint ( pic attached)


    Aashish_0-1704670747313.png

     

    Aashish_1-1704670757296.png

    I would be very thankful if you can guide me further !

     

  • Verified answer
    WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    @Aashish ,

    Assuming that is an Attachment field in your SharePoint List, it will not be read-only. If you send the correct ID for the record, the file will be attached to it. Also you need to use the ID requested in the trigger, not the Id of the Library item you have just created.

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard