Hello fellow colleagues,
I am starting to write a SharePoint Adapter which should work on: support SharePoint 2016 On-Premise/ Online and 365. So far I've understood that Office365 uses Online so it narrows down the supported version to: SharePoint 2016 On-Premise and SharePoint Online.
I found two different APIs for each supported version:
SharePoint 2016 On-Premise API: SharePoint Server 2016 Client Components SDK https://www.microsoft.com/en-us/download/details.aspx?id=51679
SharePoint Online API: Microsoft.SharePointOnline.CSOM (latest version - 16.1.7018.1200) https://msdn.microsoft.com/en-us/library/office/jj193041.aspx https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM/
As per the information (https://dev.office.com/blogs/using-correct-csom-version-for-sharepoint-customizations) 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. My user stories seems pretty staightforward: CRUD operations for file&folder, checkout/overrive/download/checkout.
My question: Will I be able to satisfy my straightforward user stories on both OnPremise and Online server using Microsoft.SharePointOnline.CSOM ? I was unable to find any information or some comparison mapping table between On-Premise and Online.
If any additional information is requred let me know.
Best Regards, SVG
As per comments above, for your requirements you will be able to use Microsoft.SharePointOnline.CSOM
for both OnPrem and Online CSOM code. As they both make use of the same Microsoft.SharePoint.Client
namespace.
One key difference being how you populate the credentials property of your ClientContext
object. Simple example below:
ClientContext cc = new ClientContext(siteUrl);
if (siteUrl.Contains("sharepoint.com"))
{
// spo email e.g. alex@groveale.onmicrosoft.com
cc.Credentials = new SharePointOnlineCredentials(username, password);
}
else
{
// domain login e.g. "groveale/alex"
cc.Credentials = new NetworkCredential(username, password);
}
If your OnPrem URLs contain sharepoint.com
you will need another method of detecting if Online or OnPrem.
Note - You will need to ensure that the client components SDK is up-to-date on your farm. Otherwise you may find that some of the endpoints are not available.