I want to create item into SharePoint online list through .Net core console or Web API through CSOM, so is it possible? If yes then How?
Thanks in advance!
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.Sign up to join this community
As of now, it's not possible to run a code with SharePoint CSOM under target framework equals to
netcoreapp. However, you can create a .net core project (web app for example) and change
net471. All Microsoft related packages depend on .net standard, .net framework 4.7.* also depends on .net standard, that's why you can restore all dependencies successfully. The only obvious drawback is that you lose cross-platform feature and can't run your solution on linux. Yet you can use latest asp.net core version.
Recently I've created a sample SharePoint add-in solution, based on ASP.NET Core 2.1, it's available here - ASP.NET-Core-with-SharePoint-Add-in . Please read this my answer if you want to understand how to run this sample.
For .NET Core project, SharePoint CSOM still not supported to build with it.
Support .NET Core with CSOM is Currently in Implementation. You can check the status of the User Voice using the Below link
Here is a nice workaround which will getting SharePoint CSOM run with .NET Core, I would suggest you can refer:
But it's not the official support way to run .NET Core Project with SharePoint CSOM
I investigated the possibilities and created a short code snippet to use SharePoint REST APIs with .net core (i.e. Azure functons).
In a nutshell:
You can find the code and detailed solution description here.