Sponsors Gold Share Point Saturday Custom REST services

  • Slides: 20
Download presentation
Sponsors Gold Share. Point Saturday Custom REST services and j. Query AJAX Silver Bronze

Sponsors Gold Share. Point Saturday Custom REST services and j. Query AJAX Silver Bronze Building your own custom REST services and consuming them with j. Query AJAX

about John Liu • Senior Consultant for Share. Point Gurus Sydney • Blog http:

about John Liu • Senior Consultant for Share. Point Gurus Sydney • Blog http: //johnliu. net • Community: user groups, Share. Point Conferences and Share. Point Saturday • @johnnliu • Loves. NET - Share. Point 2007, 2010, Silverlight & Windows Phone • Video games, board games, D&D Share. Point Saturday Melbourne 2012

Contents • Intro – j. Query – REST API (out of the box) •

Contents • Intro – j. Query – REST API (out of the box) • • Create SOAP service Create REST service Highly responsive websites with j. Query AJAX Create ADO. NET Data. Service Share. Point Saturday Melbourne 2012

Intro - j. Query in 1 slide • Java. Script library • Select using

Intro - j. Query in 1 slide • Java. Script library • Select using CSS rules, then do something with the selected set • Lots of helper functions, utilities • Externally injected so doesn’t interfere with how Share. Point works • $("div. mybox"). add. Class("yourbox"). show(); • http: //jquery. com/ Share. Point Saturday Melbourne 2012

Intro - Share. Point REST API in 1 slide • /_vti_bin/List. Data. svc/ Share.

Intro - Share. Point REST API in 1 slide • /_vti_bin/List. Data. svc/ Share. Point Saturday Melbourne 2012

Question before demo • How many have written web parts for Share. Point •

Question before demo • How many have written web parts for Share. Point • How many have build your own WCF services at some point – (for Share. Point? ) Share. Point Saturday Melbourne 2012

Code Demo WRITE YOUR OWN SOAP AND REST SERVICES Share. Point Saturday Melbourne 2012

Code Demo WRITE YOUR OWN SOAP AND REST SERVICES Share. Point Saturday Melbourne 2012

Building your own WCF services • Useful for Info. Path • SP 2013 -

Building your own WCF services • Useful for Info. Path • SP 2013 - new Workflow Action "Call HTTP Web Service" • The problem with WCF: Error “This collection already contains an address with scheme http” Configuration necessary in web. config • Use Microsoft. Share. Point. Client. Services. Multiple. Ba se. Address. Basic. Http. Binding. Service. Host. Factory Share. Point Saturday Melbourne 2012

What you can do in a REST service • • • SPContext. Current Check

What you can do in a REST service • • • SPContext. Current Check current user's roles and permissions Make read and write database calls SPSecurity. Run. With. Elevated. Privileges SPUtility. Send. Email Perform disk IO • Use Microsoft. Share. Point. Client. Services. Multiple. Base. Ad dress. Web. Service. Host. Factory • Reminder: remember SPDispose. Check Share. Point Saturday Melbourne 2012

AJAXify your UI • Define: AJAX – do it without refreshing the browser. This

AJAXify your UI • Define: AJAX – do it without refreshing the browser. This means a seamless user experience • Grab just the data I need from a quick service call • Find where I want it to go • Form HTML string and append() into the existing DOM structure Share. Point Saturday Melbourne 2012

AJAX vs. Web Parts AJAX ASP. NET Web Parts Script runs on client Need

AJAX vs. Web Parts AJAX ASP. NET Web Parts Script runs on client Need to learn j. Query AJAX Debug in browser Small payload Client side DOM manipulation Best Feature • Responsive fast UI • ASP. NET hosted code • Learn ASP. NET page lifecycle • Debug in server • Larger page size (waiting…) • Connected web parts • • • Configuring webparts is easier for non-developer Share. Point Saturday Melbourne 2012

Deploy is simple Farm Solution • But doesn’t interfere with your site collections or

Deploy is simple Farm Solution • But doesn’t interfere with your site collections or deploy anything into Share. Point • Stuffed up? Delete the service folder and it's gone! • Web. Parts can be sandbox solutions – so if your service is stable, you only need to deploy/redeploy sandbox webparts to update your UI / script • Your script can be stored in the library, can be modified without redeploy Share. Point Saturday Melbourne 2012

Debug? Where!? • Debug service on the server – Holds up App Pool -

Debug? Where!? • Debug service on the server – Holds up App Pool - • Debug webpart on the browser – Holds up only your own browser – IE 9's dev tools is pretty good tool Share. Point Saturday Melbourne 2012

Bonus Demo WRITE YOUR OWN DATASERVICES Share. Point Saturday Melbourne 2012

Bonus Demo WRITE YOUR OWN DATASERVICES Share. Point Saturday Melbourne 2012

Future of j. Query, AJAX and REST • j. Query data binding – Jquery-tmpl

Future of j. Query, AJAX and REST • j. Query data binding – Jquery-tmpl – j. Qote • Knockout. JS – MVVM data-binding on client side Share. Point Saturday Melbourne 2012

Share. Point 2013 Share. Point Saturday Melbourne 2012

Share. Point 2013 Share. Point Saturday Melbourne 2012

Summary • • This is way better than writing webparts : -) j. Query

Summary • • This is way better than writing webparts : -) j. Query REST API (out of the box) Create SOAP service Create REST service Highly responsive websites with j. Query AJAX Create ADO. NET Data. Service Share. Point Saturday Melbourne 2012

Resources • REST and j. Query AJAX • http: //blogs. msdn. com/b/sharepointdev/archive/201 1/02/22/calling-a-wcf-service-using-jquery-insharepoint. aspx

Resources • REST and j. Query AJAX • http: //blogs. msdn. com/b/sharepointdev/archive/201 1/02/22/calling-a-wcf-service-using-jquery-insharepoint. aspx • http: //www. wictorwilen. se/Post/Calling-a-WCFService-using-j. Query-in-Share. Point-the-correctway. aspx • http: //johnliu. net/rest/ • Data Service http: //msdn. microsoft. com/en-us/library/dd 728279 Share. Point Saturday Melbourne 2012

Help! I'm still on 2007 • http: //spservices. codeplex. com/ • j. Query wrapper

Help! I'm still on 2007 • http: //spservices. codeplex. com/ • j. Query wrapper around Share. Point 2007 (and 2010) SOAP services • Notably, via Java. Script you can: – Update item without form – Start workflow on any item – Get information from user profile service – Talk to Search service Share. Point Saturday Melbourne 2012

Share. Point Saturday Sponsors Gold Thanks for listening! Remember to submit your feedback so

Share. Point Saturday Sponsors Gold Thanks for listening! Remember to submit your feedback so you can go into the raffle draw at the end of the day! And don’t forget that you have to be at the draw to claim your prizes! John. Liu@Sharepoint. Gurus. net @johnnliu http: //John. Liu. net Silver Bronze