Today we are releasing version 1.0.0 of the Patterns and Practices client side library. This is the culmination of several months effort by Microsoft as well as our community contributors to produce a reusable library to help simplify SharePoint client side development. It contains a fluent API for working with the SharePoint REST API as well as utility and helper functions. Designed to be consumed easily it is appropriate for us in script editor web parts, script tags, as well as working with commonjs, requirejs, and systemjs module loaders.
For performance considerations operations are asynchronous if there is a possibility of delay – making use of es6 style promises. Additionally, if you are using TypingScript you can make use of the rich intellisense and comments to explore the library and discover functionality. Additionally the library contains classes to help you add logging and caching to your application. See below for some examples and details on getting started with the library.
The library is designed primarily to make everyday SharePoint tasks easy and intuitive, here are a few examples:
For example, reading list items:
Or updating a list item:
Or for a slightly more involved example, you can ensure a list and then operate on that list. If the list doesn’t exist it will be created and then we can add an item:
There are too many specific scenarios to describe so we have created some samples and documentation linked in the section below to help get you started.
Try it out!
You can download a Visual Studio Solution that demonstrates using the library alongside requirejs. You can also take download the samples add-in for examples on using the library within your projects either in a script editor web part or a SharePoint add-in. Please also see our Wiki page on using the library in your projects.
Let us know what you think
While this is version 1 it is just the beginning. With your feedback we can grow and improve the library. So do please let us know what you think – what we did well and where we can improve.