SharePoint has been around for a while. You may have started in the early days with Full Trust code, User Controls, Pages, Timer Jobs, Workflow, InfoPath, etc. The list is limitless and so is the opportunity to develop for SharePoint. The biggest dilemma a programmer will face when approaching SharePoint is time. The goal of this blog series is to walk through the progression of how an app can transform from early development to modern practices. The first part of this blog series is to address some common patterns and suggestions as we move towards the Modern Web and in reality the distributed device environment.
Each blog post will contain a set of sample code to assist in the setup, configuration, and deployment of the code. This is an extended set of samples based on the OfficeDev PnP-Site-Core and PnP-PowerShell projects. Without their assistance these samples would have been much more complicated and labor intensive. What we will demonstrate will try to adhere to 2-8 hours of real development time. You may be tempted to jump right into Provider Hosted Add-Ins or well architect-ed projects that require databases, multi-tier structure, API's, security constraints, and unit testing. Each of those are great when used in the correct context. Not all applications or requirements need a complicated architecture; especially when SharePoint has it out of the box. Hopefully at the end of this series you'll have enough sample code and patterns to start new projects with an out of the box mindset first.
The SharePoint and Office 365 community is more mature than it was a few years ago. Look to http://dev.office.com/patterns-and-practices for an example of the continuously growing community. You will find sample code, guidance, and How To's.
Before you Begin:
Each blog post will point to a specific project in the development-samples repository at https://github.com/pinch-perfect/development-samples. Fork the repository and clone it locally. This repository has a dependency on the following https://github.com/pinch-perfect/Infrastructure-As-Code repository. Infrastructure-As-Code will assist you in configuring your environment with the requisite libraries and site assets. You'll need to review/follow the instructions in https://github.com/pinch-perfect/Infrastructure-As-Code/tree/master/InfrastructureAsCode.Powershell to deploy a Binary PowerShell module that we will use to deploy artifacts to your SharePoint on premise or SharePoint online environment.
Each sample project in the development-samples solution is a console application which contains a class/model representation of lists and fields. When you run or debug the console it will produce a provisioner.json file. We will use the Infrastructure-As-Code PowerShell module to modify your SharePoint site by provisioning a list and fields from your provisioner.json file and uploading site assets from the local path in each project. Once complete it will disconnect from the site closing the Client Context.
Let's get started:
Please note: This is sample code meant to start the dialog. It is intended to ease you into SharePoint development and assist in demonstrating features, development techniques, and Model-View-ViewModel design within SharePoint.
Step 5: SharePoint Add-In
Step 6: Provider Hosted Add-In