I'm working on a WebPart, which has a form and a button. On button click write items in a SharePoint List. So, the button click is my last step, but the buton does not work. I get everytime:

Expected 3 arguments, but got 2.

And bellow my code

 <DefaultButton className={styles.button} onClick={() => this.addListItems(this.state.data, this.state.selectedDepartmentOptions)}> Eintragen </DefaultButton>

 private addListItems = (user: MicrosoftGraph.User, selectedDepartmentOptions: IDropdownOption[], destinations: IDropdownOption): void =>  {

const { selectedRubrikOptions } = this.state;
const departmentKey = user.department;
var isTerminvergabeChecked = (document.getElementById('terminvergabe') as HTMLInputElement | null).checked;
var isHotlineChecked = (document.getElementById('hotline') as HTMLInputElement | null).checked;
let selectedDepartmentText = "";

for (let i = 0; i < selectedDepartmentOptions.length; i++) {
  const option = selectedDepartmentOptions[i];

  if (option.key === departmentKey) {
    selectedDepartmentText = option.text;

if(selectedRubrikOptions === ""){
  alert('Bitte das Pflichtfeld beachten!');

    'Rubrik': selectedRubrikOptions,
    'Au_x00df_enstellen': selectedDepartmentText,
    'Terminvergabe': isTerminvergabeChecked,
    'Hotline': isHotlineChecked,
  .then(()=> alert("Die Daten wurden erfolgreich gespeichert!"));


Anyone, any solution? I seat since 2 hours whith this problem.

1 Answer 1


You defined your function to recieve 3 arguments :

 private addListItems = (user: MicrosoftGraph.User, selectedDepartmentOptions: IDropdownOption[], destinations: IDropdownOption)
  1. User
  2. selectedDepartmentOptions
  3. destinations

while you called this function on button click

onClick={() => this.addListItems(this.state.data, this.state.selectedDepartmentOptions)
  1. User
  2. selectedDepartmentOptions

you should also pass the "destination" argument, or just delete it from your function definition, because i cannot see where you used this argument inside the function :

 private addListItems = (user: MicrosoftGraph.User, selectedDepartmentOptions: IDropdownOption[])
  • Thank you! I havenow an other error: Argument of type 'string' is not assignable to parameter of type 'IDropdownOption[]'. Do you have any idea? Feb 15, 2023 at 9:08
  • yes, in your function definition you specified that the paramter selectedDepartmentOptions is an array, while you are passing this.state.selectedDepartmentOptions is a string Feb 16, 2023 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.