Your SlideShare is downloading. ×
Spicing up SharePoint web parts
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Spicing up SharePoint web parts


Published on

From DevConnections Las Vegas, Apr 19, 2011 …

From DevConnections Las Vegas, Apr 19, 2011

Whether it’s dashboards, content publishing, or day-to-day collaboration, SharePoint’s web pages usually contain lots of web parts. Using traditional post-back techniques to refresh a single web part’s content is both slow and visually annoying. This session will cover what’s possible using AJAX, custom web services, the client object model and jQuery to spice up the SharePoint web parts that you’re cooking. Boom!

Published in: Technology

  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Spicing Up Web Parts using AJAX and Client Object Model
    Randy Williams
  • 2. About the Speaker
    US-West Coast Manager for Synergy
    Based in San Diego, California
    SharePoint MVP
    Specialty in architecting solutions
    Twitter: @tweetraw
  • 3. Agenda
    Custom Web Services
    Client Object Model
  • 4. How AJAX Works
    AJAX consists of JavaScript, DHTML and XMLHTTP
    XMLHTTPRequest object
    Acts as a web service client
    Used instead of a full postback
    Web server processes request and sends back response to browser
    Browser receives the response and updates the page dynamically
  • 5. Using AJAX in SP2010
    No configuration changes needed
    Built into web.config
    Built into v4.master
    Two primary ways
    Using UpdatePanel control (basic)
    Calling web services (advanced)
  • 6. UpdatePanel
    Part of ASP.NET 3.5
    Easiest way to add AJAX capability
    Most server-side events run as partial postbacks
    For SharePoint, use conditional mode
    up.UpdateMode= UpdatePanelUpdateMode.Conditional;
    Simple, but limited
  • 7. Demo
    Using Update Panel
  • 8. Calling Web Services
    Using AJAX, the browser can directly call into Web Services
    More powerful than UpdatePanel
    JSON is used to encode messages
    AJAX engine does most of the hard work
    Depending on the method used, OOB Web Services will not work
    Custom ones can be used
  • 9. Creating Custom Web Services
    Create new WCF Service App project
    Write web service
    Configure a web.config for web service
    Dynamic bindings will not work with AJAX
    enableWebScript endpoint behavior – allows it to be called from AJAX client
    Deploy within 14ISAPI
  • 10. Demo
    Using AJAX to Call Custom Web Service
  • 11. Client Object Model
    Working with SharePoint from client applications
    ECMAScript (JavaScript)
    .NET Managed
    Easier than calling web services directly
    Provides a subset of the functionality available in the server object model
    Designed to work with data within a site collection
  • 12. The ClientContext Object
    ClientContext is your handle to all other objects
    Site, Web, List, Item, File
    Optimizes communication to server by batching requests
    Typical usage:
    Define a query to retrieve or modify SharePoint objects
    Pass the query to one of the ClientContext’s Load methods
    Use ClientContext to execute the query
    Work with results returned
  • 13. Demo
    Client OM from Silverlight Web Part
  • 14. Session Heads-Up
    In Raphael 1, tomorrow at 1:45pm…
    Randy Williams
    SharePoint 2010: Developing with
    Data Technologies
  • 15. Using jQuery
    Multi-purpose JavaScript library
    With it, you will write less JavaScript 
    Cross-browser support
    Create interactive and usable apps
    No need to deploy assemblies
    Works great in sandboxed web parts
    Hundreds of jQuery plugins
  • 16. Where to Store these .js Libraries?
    Deploy as a module-type feature
    Works in both farm and sandboxed WSP
    Copy manually to designed libraries
    e.g. SiteAssets
    Shared or individual instances?
    Best to not rename file
    e.g. keep as jquery-1.5.1.js
  • 17. Demo
    Using jQuery
  • 18. Using SPServices
    Two primary functions
    Allows jQuery to easily call SharePoint OOB web services
    ListFormWebPart enhancements
    Download from
    Use when Client OM is insufficient
  • 19. Demo
    Using jQuery and SPServices
  • 20. Your Feedback is Important
    Please fill out a session evaluation form.
    Thank you!