SharePoint 2013 Javascript Object Model
Upcoming SlideShare
Loading in...5
×
 

SharePoint 2013 Javascript Object Model

on

  • 229 views

Presented at SharePoint TechFest Dallas 2014. All rights reserved.

Presented at SharePoint TechFest Dallas 2014. All rights reserved.

Statistics

Views

Total Views
229
Views on SlideShare
229
Embed Views
0

Actions

Likes
0
Downloads
7
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

SharePoint 2013 Javascript Object Model SharePoint 2013 Javascript Object Model Presentation Transcript

  • 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 Solution Provider-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 continued Declarative 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
  • Scott Tarnell Solution Principal SLALOMCONSULTING Glassdoor Best Places to Work 2014 Dallas Business Journal Best Places to Work 2013 Microsoft Global Office 365 Solution Partner of the Year 2012 5080 Spectrum Drive, Suite 650E Addison, TX 75001 972.419.2800 main | 972.379.7534 mobile scott.tarnell@slalom.com