In this article, I’ll explain detailed initial steps to connect Office 365 / SharePoint online using CSOM through console application.
While working with SharePoint online, most of the time, we need to perform some one-time batch operations like - associating content types to multiple lists, associating content type to list items, setting default content type for multiple lists, giving the permissions to multiple lists/sites, deleting the list items in list having some condition and this list is very large.
Also, there were no timer jobs available in SharePoint Online. So, the only option that remains is hosting the job in Azure but then it requires the extra cost of an Azure subscription. SharePoint Designer Workflow is another option but there are limitations, for some scenarios workflows doesn’t work either.
So in all those scenarios, CSOM is very helpful. We could easily write any kind of tool/application using CSOM and very easily perform such types of batch operations.
Here, I’ll be covering the first initial basic step - to connect the Office 365 / SharePoint online using CSOM.
Tools required
Detailed Steps
In above example, SharePointOnlineCredentials class requires secured string. For more details on SecureString class please have a look once here.
Complete Code
Thanks!
Enjoy Reading :)
As usual, any feedback / query / suggestions are most welcome!!!
Getting Started with Managed Metadata Service in SharePoint 2010