sharepoint 2013 javascript object model
Post on 13-May-2015
308 Views
Preview:
DESCRIPTION
TRANSCRIPT
SharePoint 2013 JavaScript Object Model…A look into Client Side Development
Revised 04/29/2014
Topics
How to create a Declarative Deployment Solution
Benefits and Limitations of JSOM
Why context is so important?
My favorite JSOM Development Pattern
Leveraging JSOM to deliver business solutions through SharePoint
APP vs SolutionProvider-hosted apps: App written in provider’s choice of language is hosted on a dedicated server or third-party hosting service.
SharePoint-hosted apps: App written in HTML and JavaScript is hosted by SharePoint.
http://msdn.microsoft.com/en-us/library/office/fp179930(v=office.15).aspx
APP vs. Solution continuedDeclarative Solutions: Visual Studio provides a mechanism for creating a Declarative Solution that is invoked by utilizing the Sandbox Solution project type and selecting to not include an assembly within the package. Note this configuration supports deployment of JavaScript files, style sheets, and xml markup files like those used to create custom actions and site columns but does not support C# code. Publishing creates a .wsp file that can be used to load into the site collection solution store.
Benefits Limitations
Deploys to both O365 and On-Premises
Can’t break SharePoint farm
Easy to implement/prototype UX designs
Faster time to market
Its asynchronous and therefore slower
Objects have to be requested
Entire object model is not implemented
No feature receivers
Pay attention to what is in your CONTEXT!
Why context is so important?
With server-side C# farm solutions you create an instance of an object and you have all of its properties and members available.
With client-side JSOM (actually any language) you request an object and you get nothing unless you load it into your context.
With SharePoint’s implementation of the client side libraries instantiating an object is not enough, certain properties and members must be requested explicitly.
Singleton Single Object Namespacing with Object Literal Notation Pattern
Only one instance of the object on the page
Uses a single global variable to reference an object
The object contains a collection of key:value pairs with a colon separating each pair of keys and values
Syntax requires a comma to be used after each key:value pair with the exception of the last item in your object
"use strict";var myclassname= { properties: { global1: null, global2: null },
init: function () { // Wires up local properties }, load: function () { // request items and load in to globa1 and global2 }}
<script>
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', myclassname.init);
</script>
DEMO Code Sample: Live Tiles
DEMO Code Sample: Asset Gallery
© 2012-2014 Slalom Corporation. All rights reserved. The information herein is for informational purposes only and represents the current view of Slalom Corporation as of the date of this presentation.SLALOM MAKES NO WARRANTIES, EXPRESS, IMPLIED, OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Scott TarnellSolution PrincipalSLALOMCONSULTING
Glassdoor Best Places to Work 2014Dallas Business Journal Best Places to Work 2013Microsoft Global Office 365 Solution Partner of the Year 2012
5080 Spectrum Drive, Suite 650EAddison, TX 75001972.419.2800 main | 972.379.7534 mobilescott.tarnell@slalom.com
top related