THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
you should get an error that GET is not a supported method
Configure web part
in the command line
change the working directory to the webpart folder
run npm i
in your code editor open the webpart folder
in the ./src/webparts/createTask/components/CreateTask.tsx file
in line 76 replace the URL with the URL of your API App
in the command line execute gulp serve
add the web part to SharePoint workbench
enter the name of the new item and click the Create button
verify that a new item with the name you specified has been created in the Tasks list
Features
This project contains sample Web API using app-only permissions to create items in a specific SharePoint list, and a client-side web part connected to that API.
This project illustrates the following concepts:
elevating user privileges for communicating with SharePoint through a custom Web API
connecting SharePoint Framework client-side web part to a custom Web API hosted in Azure
persisting state in React components
communicating state updates in React components to users
executing REST API web requests from React components
using Office UI Fabric React components in SharePoint Framework client-side web parts