03 | Client Side SharePoint Development

Slides:



Advertisements
Similar presentations
1 Euro-VO Technology Forum, 23 September 2009, Annotations at the CDS Web 2.0: annotations at the CDS Brice GASSMANN Sébastien DERRIERE Thomas BOCH.
Advertisements

©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July Solution Architect,Microsoft.
Microsoft ® Official Course Client-Side SharePoint Development SharePoint Practice Microsoft SharePoint 2013.
Microsoft ASP.NET AJAX - AJAX as it has to be Presented by : Rana Vijayasimha Nalla CSCE Grad Student.
06 | Implementing Web APIs Jon Galloway | Tech Evangelist Christopher Harrison | Head Geek.
Microsoft ® Official Course Creating Robust and Efficient Apps for SharePoint Microsoft SharePoint 2013 SharePoint Practice.
Microsoft ® Official Course Interacting with the Search Service Microsoft SharePoint 2013 SharePoint Practice.
Microsoft ® Official Course Introducing Apps for SharePoint SharePoint Practice Microsoft SharePoint 2013.
Fraser Technical Solutions, LLC
©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 2013 Technical Preview and published July Introducing.
App development in SharePoint 2013 LIVE Introducing Cloud App Model Cloud-hosted Apps Experiences from the Field.
Hennie Laubscher K2 Brian Farnhill Independent Consultant.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
NextGen Technology upgrade – Synerizip - Sandeep Kamble.
Ajax (Asynchronous JavaScript and XML). AJAX  Enable asynchronous communication between a web client and a server.  A client is not blocked when an.
JavaScript & jQuery the missing manual Chapter 11
Facebook Like Solution in SharePoint Using JavaScript Amie Seisay
JavaScript, Fourth Edition Chapter 12 Updating Web Pages with AJAX.
REST.  REST is an acronym standing for Representational State Transfer  A software architecture style for building scalable web services  Typically,
November 13, 2008 Ohio Information Security Forum Attack Surface of Web Applications James Walden Northern Kentucky University
Getting Started with the ASP.NET Web API Dhananjay Kumar Infragistics Consultant Microsoft MVP
Spicing Up Web Parts Randy Williams SharePoint Hawaii User Group May 11, 2011.
Cross Site Integration “mashups” cross site scripting.
Sponsors Gold Silver Bronze Custom REST services and jQuery AJAX Building your own custom REST services and consuming them with jQuery AJAX.
Module 10 Administering and Configuring SharePoint Search.
Introduction to the SharePoint 2013 REST API. 2 About Me SharePoint Solutions Architect at Sparkhound in Baton Rouge
Sponsors Gold Silver Bronze Custom REST services and jQuery AJAX Building your own custom REST services and consuming them with jQuery AJAX.
Online Conference June 17 th and 18 th SharePoint Online Administration with PowerShell.
Module 7: Advanced Application and Web Filtering.
Copyright © 2006 Pilothouse Consulting Inc. All rights reserved. Search Overview Search Features: WSS and Office Search Architecture Content Sources and.
WORKING WITH THE “CALL HTTP WEB SERVICE” WORKFLOW ACTIVITY Derek Nishino Nishino Consulting
JQuery and AJAX WEB Technologies : PHP Programming Language.
Welcome to the Minnesota SharePoint User Group February 13 th, 2013 SharePoint 2013 – Developers Track - Client Side Rendering.
Facebook Like Solution in SharePoint Using JavaScript Amie Seisay
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
CHAPTER 8 AJAX & JSON WHAT IS AJAX? Ajax lets you…
AJAX and REST. Slide 2 What is AJAX? It’s an acronym for Asynchronous JavaScript and XML Although requests need not be asynchronous It’s not really a.
JavaScript, Sixth Edition Chapter 11 Updating Web Pages with Ajax.
Overview Silverlight Client Object Model JavaScript Client Object Model Calling SharePoint Web Services Summary.
JQuery, JSON, AJAX. AJAX: Async JavaScript & XML In traditional Web coding, to get information from a database or a file on the server –make an HTML form.
Course Agenda Deep Dive into the Building Blocks and Services of the SharePoint Platform Module 1: Developing Advanced Workflow Scenarios in Office 365.
A Developer’s Introduction to SharePoint 2013 Apps Ryan McIntyre, MCITP, MCPD National
Powering up your Office 365 cmdlets with CSOM Bjoern H Rapp, Senior Architect Public Cloud, SopraSteria.
National College of Science & Information Technology.
Web API - Introduction AJAX, Spring Data REST SoftUni Team Web API
Node.js Express Web Applications
CS 371 Web Application Programming
CSOM and REST Name Title Company.
Data Virtualization Tutorial… CORS and CIS
Building Dynamic Applications with the SharePoint Client Object Model
SharePoint Architect & Developer
Node.js Express Web Services
AJAX and REST.
An introduction to REST for SharePoint 2013
PHP / MySQL Introduction
SharePoint Online Development Best Practices
Testing REST IPA using POSTMAN
WEB API.
02 | Web API Basic Design Jeremy Likness | Principal Architect
DWR: Direct Web Remoting
Intro to Client Side Solutions in SharePoint 2013
REST Client Tutorial by Pavan Ethic Coder
07 | Workflows Chris Johnson | SharePoint Guru
Windows Azure Keenan Newton 3-021
ASP.NET Module Subtitle.
Mike Ammerlaan Program Manager Microsoft Corporation
Microsoft Graph – Intune API’s
04 | Apps and SharePoint Chris Johnson | SharePoint Guru
Server-Side Programming
.NET Framework V3.5+ & RESTful web services
Presentation transcript:

03 | Client Side SharePoint Development Chris Johnson | SharePoint Guru Christopher Harrison | Microsoft Certified Trainer

Module Overview REST API with JavaScript 20488A 09: Client-Side SharePoint Development REST API with JavaScript  

Lesson 1: Client-Side Object Model for JavaScript 09: Client-Side SharePoint Development Handling Server-Side Errors  

Overview of the CSOM for JavaScript 09: Client-Side SharePoint Development Components of the CSOM Linking to Script Libraries Using the CSOM Proxy   App SharePoint Content DB Custom JavaScript JavaScript CSOM JSON Client.svc Service Proxy XML

Using the Client Context Object 20488A Using the Client Context Object 09: Client-Side SharePoint Development getSiteCollection = function () { context = new SP.ClientContext.get_current(); siteCollection = context.get_site(); context.load(siteCollection); context.executeQueryAsync(onSuccess, onFailure); }, onSuccess = function () { alert("URL: " + siteCollection.get_url()); onFailure = function(sender, args) { alert("Could not obtain the site collection URL"); } The code on the slide shows how to use the client context object in an asynchronous call. Note that the code omits the encapsulation code used in the example in the student notes because there is insufficient room. When you discuss the code on the slide, remind the students of the importance of encapsulation and refer them to the code example in the student workbook.

Loading Objects and Running Queries 09: Client-Side SharePoint Development Loading Objects Context.Load() Context.LoadQuery() Execution ExecuteQueryAsync() Success Failure  

Changing SharePoint Data 09: Client-Side SharePoint Development Creating a new list in a site Creating a new item in a list Updating an existing item in a list Deleting an item from a list  

Client Side Object Model via JavaScript

Handling Server-Side Errors 09: Client-Side SharePoint Development By default, a server-side error causes the whole batch of operations to fail. Use an Error Handling Scope to define server-side try/catch/finally There is not space to show all the relevant code on the slide so the most important calls have been included. Make sure students refer to the student manual for a complete version of the code. var e = new SP.ExceptionHandlingScope(context); var s = e.startScope(); var t = e.startTry(); //This is the try block t.dispose(); var c = e.startCatch(); //This is the catch block c.dispose();

Lesson 2: Using the REST API with JavaScript 09: Client-Side SharePoint Development Creating and Updating Data  

Overview of the REST API 09: Client-Side SharePoint Development RESTful Services: Use Logical URLs to specify objects Use HTTP verbs to specify operations Use OData to exchange data Client.svc service is a REST API In the code example, the address of the SharePoint site ("http://intranet.contoso.com") is hard-coded into the request. This makes the example easy to understand but is not sensible in most apps, where you do not know the address of the app web or host web at coding time. If students ask about this hard-coded URL, explain that they will see how to obtain the URL of the current site later in the module. $.getJSON( "http://intranet.contoso.com/_api/web", function (data) { alert('site is called: ' + data.d.Title); } )

SharePoint REST API URLs 09: Client-Side SharePoint Development Address of the REST API URLs for Common SharePoint Objects Using OData Operators The REST API URL on the slide demonstrates all the parts of an advanced URL. Point out to the students the URL of the SharePoint site, the address of the Client.svc service, the method used to obtain the items in the MyList list and the three OData operators used to control the items returned. http://intranet.contoso.com /_api/web/lists/getbytitle("MyList")/items ?$select=ID,Title &$order=Title &$filter=startswith(Title,”A”)

20488A Reading Data 09: Client-Side SharePoint Development Using the _spPageContextInfo.webServerRelativeUrl property The jQuery getJSON() function The jQuery ajax() function  

Creating and Updating Data 09: Client-Side SharePoint Development Always pass a form digest Creating New Items Formulate a URL to the parent list in the REST API Use the POST verb Updating Existing Items Formulate a URL to the item itself Use the PATCH, MERGE, or PUT verbs Deleting Items Use the DELETE verb  

REST API and JavaScript