Question

I'm maintaining a CSOM CLI solution for interacting with SharePoint 2013 (automated creation of lists and libraries, manage groups, ...). The solution is built with the SharePoint Server 2013 Client Components SDK.

The solution should now be extended for SharePoint Online. The same codebase should work against both 2013 On Premise and Online.

As far as I understand, the SharePoint Online CSOM SDK is some sort of superset of the On Premise CSOM SDKs. From what I've read in this article from Vesa Juvonen at the Office Dev Center from 2016 I could use the Online CSOM SDK for interacting with On Premise as long as I make sure I'm just using the properties and methods that are already exposed for 2013:

If you can guarantee that your code does not touch properties which have not been enabled in on-premises version, you can theoretically use SharePoint Online CSOM with on-premises as well.

So my first idea now is to exchange the 2013 CSOM SDK within my solution with the SharePointPnPCoreOnline NuGet package.

However the Vesu Juvonen also says:

We do however recommend on using right CSOM version for specific server side version to avoid issues.

But I would like to avoid building and shipping two versions of my solution (On Premise and SPO).

My question is, if anybody has encountered problems when using the SharePointPnPCoreOnline SDK against SharePoint 2013 On Premise. Or maybe there is a more elegant solution for building a solution that is capable of working with 2013 and SPO nowadays?

Was it helpful?

Solution

I've done some testing using the SharePointPnPCoreOnline NuGet package version 2.26.1805.1 (2018-05-15) against a SharePoint 2013 on premise farm (Version 15.0.4971.1000; October 2017 CU).

I can confirm that the following operations are working:

Note: MSC = Microsoft.SharePoint.Client namepace

Web(s)

  • Adding new properties to MSC.Web.AllProperties
  • Working with navigation (adding new nodes, modify existing nodes, delete nodes) (MSC.NavigationNodeClient)
  • Modifiying title, description and site logo of a web

Lists

  • Creating new lists (MSC.ListCreationInformation)
  • Modifying settings of existing lists (MSC.List)
  • Creating new views (MSC.ViewCreationInformation)
  • Modifying existing views (fields to show, items per page, ...) (MSC.View)
  • Adding new fields to a list (single line of text and lookup) (MSC.FieldCreationInformation)
  • Creating a new site column (MSC.Web.Fields.Add())

Files and items

  • Adding new items (MSC.ListItemCreationInformation)
  • Adding / uploading new files
  • Check in / check out / approve files

Permissions / securable objects

  • Breaking role inheritance
  • Setting permissions on web / on list
  • Modifying exisiting role definitions (MSC.RoleDefinition)
  • Addding new role definitions (MSC.RoleDefinitionCreationInformation)
  • Creating new groups (MSC.GroupCreationInformation)
  • Deleting existing groups (MSC.Group)
  • Adding users to a group
  • Adding users as site collection admin

User profiles

  • Retrieving properties (e.g. department or phone number) via MSC.UserProfiles.PeopleManager

Webparts

  • Placing new webparts (Hyperlink, ListView, MembersWebpart, ScriptEditor) (MSC.WebParts.WebPartDefinition)
  • Modifiying webparts properties

Features

  • Activating web / site collection features (MSC.FeatureCollection)

Website feed

  • Creating posts with links (MSC.Social.SocialFeedManager / MSC.Social.DataItem)
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top