1

I have a code to work with SharePoint by using CSOM. It is roughly the same for SharePoint 2016 and SharePoint Online, except for few lines. I want that my application work both with SharePoint 2016 and SharePoint Online simultaneously.

However, I cannot achieve this. If I install NuGet package for SharePoint Online, code runs fine with SharePoint Online but fails with SharePoint 2016. If I install NuGet package for SharePoint 2016, code runs fine with SharePoint 2016 but fails with SharePoint Online. How to make an application, which can work with both servers at the same time?

It seems that both NuGet packages use equally named SharePoint CSOM assemblies, which just replace one another and cannot coexist. Errors are standard for unresolved methods in CSOM, such as:

Cannot find stub for type with id "{154360b4-899f-4237-b0ed-3e35f014c748}". The specified server may not support APIs used in this operation. at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream

Any ideas and suggestions are much appreciated.

0

1 Answer 1

1

There is a related question on the Microsoft technet platform here.

There is an anwer from Sergio Russo which states that he actually does target both SPO and SP on prem. Have a look at that.

3
  • 1
    Even despite it worked for me, I still have doubt, if it will work universally. For instance, below link explicitly states that 2016 and Online packages are NOT compatible: github.com/SharePoint/PnP/issues/1410 Jun 15, 2018 at 11:31
  • @BorisZinchenko Indeed, I would be careful too...
    – helb
    Jun 15, 2018 at 12:10
  • 2016 and Online use different dlls versions with the same name, some functions will work as they have basically the same functionality, but others will probably fail with misleading errors
    – Mike
    Jun 15, 2018 at 15:15

Your Answer

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

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