antonio-leonardo / SharePointProviderHostedApi

This projected API is a result from a refactor from Visual Studio SharePoint Add-In Template Project, to in SharePoint 2016 Hosted, SharePoint OnLine or Hybrid Farm, this is a alternatively if you want a decople solution for C# Provider Hosted Solutions, This was tested in SharePoint 2016 and SharePoint Online project customizations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

C# SharePoint Provider-Hosted Api

This designed API is a result from a Visual Studio SharePoint Add-In Template Project refactoring, to be useful at Hight Trust (SharePoint 2016 Hosted) or Low Trust (SharePoint OnLine) or Hybrid Farm scenarios; this is can a alternative if do you want a decople solution for C# Provider Hosted Solutions. This was tested in SharePoint 2016 and SharePoint Online project customizations using Asp.NET Web Forms.

Dependecies

i. Needed to install a nuget package for Microsoft.Identity.Model and Newtonsoft.Json;

or

ii. Microsoft SharePoint Components SDK for SharePoint Online and SharePoint 2016;

-The second way is better!

Examples of use

Instantiate ClientContext object from this API object called SharePointContextCSOM and all the magic is will be succed! Because this Api has all specified sharepoint artefact items that the application needs to contextualize, giving to developer only responsability to make C.R.U.D. roles, view the example:

//For current site:
SharePointContextCSOM _providerHostedApi = new SharePointContextCSOM(HttpContext.Current, "NameOfList");

//For remote site:
SharePointContextCSOM _providerHostedApi =
              new SharePointContextCSOM(HttpContext.Current, "http://remote/site/access", "NameOfList");

using(ClientContext ctx = _providerHostedApi.SharePointClientCtx)
{
  //To do SharePoint consume business rule...
}

License

View MIT license

About

This projected API is a result from a refactor from Visual Studio SharePoint Add-In Template Project, to in SharePoint 2016 Hosted, SharePoint OnLine or Hybrid Farm, this is a alternatively if you want a decople solution for C# Provider Hosted Solutions, This was tested in SharePoint 2016 and SharePoint Online project customizations

License:MIT License


Languages

Language:C# 100.0%