I’ve been doing quite a bit of work lately with remote code execution for SharePoint Online (SPO) to deploy artifacts (sites, webs, columns, content types, etc.). While the OfficeDev PnP project on GitHub is the definitive way to go and we should all be following those patterns for large-scale SPO dev efforts, much of what I’ve been doing is very ad-hoc. To help with this, I’ve created a simple “starter” console app for working with SharePoint Online. Check it out here: https://github.com/skaggej/sharepoint/tree/master/SPO_Console_Starter.
This console app has everything you need to get started. It was built with references to the SharePoint Online assemblies (v16) via the NuGet package at https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM. Make sure to install that if you have issues.
If you change nothing and simply run it, you’ll be prompted for the authentication info for your SPO environment and, once authenticated, the console app will simply output “Hello, SPO!”
private static void ExecuteCustomCode()