Sponsors Gold Custom REST services and j Query

  • Slides: 21
Download presentation
Sponsors Gold Custom REST services and j. Query AJAX Silver Bronze Building your own

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

Custom REST services and j. Query AJAX BUILDING YOUR OWN CUSTOM REST SERVICES AND

Custom REST services and j. Query AJAX BUILDING YOUR OWN CUSTOM REST SERVICES AND CONSUMING THEM WITH JQUERY AJAX Melbourne 2011

about John Liu • Senior Consultant for Share. Point Gurus • Blogging • User

about John Liu • Senior Consultant for Share. Point Gurus • Blogging • User Groups, Share. Point Conferences and Share. Point Saturday • Loves. NET • Share. Point 2007, 2010, Silverlight & Windows Phone • @johnnliu Surface! Melbourne 2011

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 Melbourne 2011

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/ Melbourne 2011

Intro - Share. Point REST API • /_vti_bin/List. Data. svc/ Melbourne 2011

Intro - Share. Point REST API • /_vti_bin/List. Data. svc/ Melbourne 2011

Quick tip with IE • If you see this, IE is trying to be

Quick tip with IE • If you see this, IE is trying to be helpful Uncheck! Melbourne 2011

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

Question before demo • How many have written webparts for Share. Point • How many have build your own WCF services at some point? • In Share. Point? Melbourne 2011

Code Demo WRITE YOUR OWN SOAP AND REST SERVICES Melbourne 2011

Code Demo WRITE YOUR OWN SOAP AND REST SERVICES Melbourne 2011

Building your own WCF services • Useful for Info. Path • The problem with

Building your own WCF services • Useful for Info. Path • 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 Melbourne 2011

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 Do whatever you want! • Use Microsoft. Share. Point. Client. Services. Multiple. Base. Ad dress. Web. Service. Host. Factory • Reminder: remember SPDispose. Check Melbourne 2011

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

AJAXify your UI • Define: AJAX – do it without refreshing the browser • 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 Melbourne 2011

AJAX vs. Web Parts AJAX • • • Script runs on client Need to

AJAX vs. Web Parts AJAX • • • Script runs on client Need to learn j. Query AJAX Debug in browser Small payload Client side DOM manipulation ASP. NET Web Parts • ASP. NET hosted code • Learn ASP. NET page lifecycle • Debug in server • Larger page size • Connected web parts • Super fast UI • Configuring webparts is easier for non-developer Melbourne 2011

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 Melbourne 2011

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 are pretty good all round Melbourne 2011

Bonus Code Demo WRITE YOUR OWN DATASERVICES Melbourne 2011

Bonus Code Demo WRITE YOUR OWN DATASERVICES Melbourne 2011

Future of j. Query AJAX + REST • j. Query – tmpl - templating

Future of j. Query AJAX + REST • j. Query – tmpl - templating – j. Qote - templating – datalink - link two objects together (databinding) • Out of box grids – Telerik Melbourne 2011

Summary • Hands up if you think this is better than writing webparts :

Summary • Hands up if you think this is 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 Melbourne 2011

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/ • Data Service http: //msdn. microsoft. com/en-us/library/dd 728279 Melbourne 2011

Help me, I'm still on 2007, you're my only hope • http: //spservices. codeplex.

Help me, I'm still on 2007, you're my only hope • 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 Melbourne 2011

Sponsors Gold John. Liu@Sharepoint. Gurus. net @johnnliu http: //John. Liu. net Thanks for listening!

Sponsors Gold John. Liu@Sharepoint. Gurus. net @johnnliu http: //John. Liu. net 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! Silver Bronze