I was wondering if someone would advise the best approach. I'm looking to develop a desktop application that will perform a number of queries to SharePoint list items in Team Sites and My Sites. Possibly downloading files and uploading etc.

I'm currently researching which would be the best method. I've used CSOM but this article Using correct Client Side Object Model (CSOM) version for SharePoint customizations

I don't want to be tied to a particular CSOM version as I want this to work both for SharePoint 2013 and 2016 and possibly any future versions.

What would be the best approach?

In this article it says the following?

I have tested SPO CSOM to on-premises and it works, why is that?

It works fine unless you will use properties or methods which are not exposed in the on-premises. 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. We do however recommend on using right CSOM version for specific server side version to avoid issues.

Can these properties/methods be enabled or is this out of box and can not be changed?

2 Answers 2


First of all SharePoint CSOM will work almost without any code changes if you change the dlls from 2013 onprem version to online or 2016 version. The only exception being if you have used any deprecated methods. Also the likely scenrio is once you move to online & 2016 CSOM, you will have more apis available. Now you could follow below good practices in your application so that things will be easy when you migrate:

  1. Use Dependency injection and try to confine SharePoint dlls into your service layer or repository layer.

  2. Use OfficeDevPnP : This is a nuget package you can download and different package is available for each version. So in future when you move to online, the only thing you will have to do is to uninstall the old nuget of PnP and install the new version.


This webcast covers CSOM versioning including strategies you can use when you want to have one code base that can work with multiple environments. Basically you build your code with the "lowest" CSOM version you want to support. For example, if you want to support SharePoint 2016 and SharePoint Online, you build your code using the SharePoint 2016 assemblies.

PnP Web Cast - SharePoint Client Side Object Model versioning for your customizations

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.