Provisioning with the Client Object Model Part 1 – Introduction

I suppose there are many ways that you could get started writing CSOM and JSOM code, but provisioning is probably where most people will start when they create a SharePoint app for a traditional collaboration solution. After all, the implementation of these types of solutions usually starts with fields, content types, lists, and views. The provisioning of these things is the subject of this series of posts.

Client Side Object Model and C# versus the JavaScript Client Object Model

Given my recent series on JavaScript you might be surprised that all of the code in this series will be written in C#! My general opinion is that provisioning (and other server-type operations) should be done in a remote event receiver to process the App installed event and that user interface code should be written in JavaScript. In other words, both models have their place and an App will have some of both. Once you are comfortable with JavaScript moving back and forth between the API’s is easy because the differences are minor. If you’d rather have this code in JavaScript you should have no trouble converting it.

Unfortunately, remote event receivers don’t seem to work with the current beta bits. Because of this I am using a high-trust provider hosted site for the App in my development environment. The start page has some buttons I can click to run my code in-lieu of an event handler.

Goals

I have a few general goals that the code must meet for my satisfaction. These include minimizing the number of round trips between my App and the host web and maximizing reuse. I know I’ll need this code for many different projects! But, the main thing I want is a good style that shares my favorite aspect of feature CAML, readability. Because this code base is very much a work in progress I won’t be including a download as I usually do… at least not yet.

In the next post I’ll talk show you how I provision the easiest type of item to provision – fields.

Next Post: Provisioning with the Client Object Model Part 2 – Getting Started and Provisioning Fields

–Doug

Author: Doug Ware