SPFX : Sharepoint list column does not Exists
Question
Error message: The property 'RequesterEmpID' does not exist on type 'SP.Data.XYZListItem'. Make sure to only use property names that are defined by the type.
I edited some of the list column names in SharePoint. after which I get this error. 'RequesterEmpID' is one of the list column which was renamed.
Code:
export function addDatatoSharepoint(props){
return dispatch => {
props.Web.lists.getByTitle('Listname').items.add({
RequesterName: props.FirstName + " " + props.LastName,
RequesterJobTitle: props.Title,
RequesterEmpID: props.EmpID,
RequesterDepartment: props.Department,
RequestDate: new Date().getDate(),
DocumentID: props.DocumentID,
}).then(r => {
console.log(r);
});
}
}
Solution
While adding item to SharePoint list, we need to use the internal name of the column.
Check the internal name of your RequesterEmpID
column using below link and use it in your code:
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange