Skip to main content
added 271 characters in body
Source Link
Jerry
  • 2.6k
  • 1
  • 11
  • 11

Try to use catch in the code snippet to get the exception in the code snippet like below:

import { default as pnp, ItemAddResult } from "sp-pnp-js";
private PnPAddItem():void
{
     pnp.sp.web.lists.getByTitle("Jerry").items.add({
      EmployeeName : document.getElementById('EmployeeName')["value"],
      Experience : document.getElementById('Experience')["value"],
      Location: document.getElementById('Location')["value"]
  })
  .then((iar: ItemAddResult) => {
      console.log(iar);
  })
  .catch((error:any) => {
      console.log("Error: ", error);
  });

}

Try to trace the error in catch for more detailed information and find the cause.

Update: Try to check the detailed response data using Developer Tool to trace the issue:

enter image description here

enter image description here

Try to use catch in the code snippet to get the exception in the code snippet like below:

import { default as pnp, ItemAddResult } from "sp-pnp-js";
private PnPAddItem():void
{
     pnp.sp.web.lists.getByTitle("Jerry").items.add({
      EmployeeName : document.getElementById('EmployeeName')["value"],
      Experience : document.getElementById('Experience')["value"],
      Location: document.getElementById('Location')["value"]
  })
  .then((iar: ItemAddResult) => {
      console.log(iar);
  })
  .catch((error:any) => {
      console.log("Error: ", error);
  });

}

Try to trace the error in catch for more detailed information and find the cause.

Try to use catch in the code snippet to get the exception in the code snippet like below:

import { default as pnp, ItemAddResult } from "sp-pnp-js";
private PnPAddItem():void
{
     pnp.sp.web.lists.getByTitle("Jerry").items.add({
      EmployeeName : document.getElementById('EmployeeName')["value"],
      Experience : document.getElementById('Experience')["value"],
      Location: document.getElementById('Location')["value"]
  })
  .then((iar: ItemAddResult) => {
      console.log(iar);
  })
  .catch((error:any) => {
      console.log("Error: ", error);
  });

}

Try to trace the error in catch for more detailed information and find the cause.

Update: Try to check the detailed response data using Developer Tool to trace the issue:

enter image description here

enter image description here

Source Link
Jerry
  • 2.6k
  • 1
  • 11
  • 11

Try to use catch in the code snippet to get the exception in the code snippet like below:

import { default as pnp, ItemAddResult } from "sp-pnp-js";
private PnPAddItem():void
{
     pnp.sp.web.lists.getByTitle("Jerry").items.add({
      EmployeeName : document.getElementById('EmployeeName')["value"],
      Experience : document.getElementById('Experience')["value"],
      Location: document.getElementById('Location')["value"]
  })
  .then((iar: ItemAddResult) => {
      console.log(iar);
  })
  .catch((error:any) => {
      console.log("Error: ", error);
  });

}

Try to trace the error in catch for more detailed information and find the cause.