SlideShare a Scribd company logo
Working with the
SharePoint Object
Models



Rob Windsor
rwindsor@portalsolutions.net
@robwindsor
SharePoint Developer APIs
• Server Object Model
    Used by client apps running on SP server
• Client Object Models (CSOM)
      Remote API
      Three entry points: .NET Managed, Silverlight, JavaScript
      Façade layer on top of WCF service
      Uses batching model to access resources
• REST Web Services (API)
    SP 2010: CRUD on list data only
    SP 2013: API expanded to be more like CSOM
• SharePoint Web Services
    “Legacy” SOAP-based web services
Server Object Model
• Can be used when “in the context” of SharePoint
   Code-behind, event handlers, timer jobs
   ASP.NET applications running in same app. pool
   Client applications that run on SharePoint servers
• API implemented in Microsoft.SharePoint.dll
• Core types map to main SharePoint components
   SPSite, SPWeb, SPList, SPDocumentLibrary,
    SPListItem
   SPContext gives access to current context
Server Object Model
• The SharePoint version of “Hello, World”
     Show the root site of a collection and it’s lists


using (var site = new SPSite("http://localhost/sites/demo/"))
{
    var web = site.RootWeb;

    ListBox1.Items.Add(web.Title);

    foreach (SPList list in web.Lists)
    {
        ListBox1.Items.Add("t" + list.Title);
    }
}
Resource Usage
• SPSite and SPWeb objects use unmanaged resources
    Vital that you release resources with Dispose
• General rules:
    If you create the object, you should Dispose
        var site = new SPSite(“http://localhost”);
        var web = site.OpenWeb();
    If you get a reference from a property, don’t Dispose
        var web = site.RootWeb
    There are exceptions to these rules
• Use SPDisposeCheck to analyze code
DEMO
Hello World with Server OM
Event Handlers
• Override methods on known receiver types
   SPFeatureReceiver
   SPListEventReceiver
   SPItemEventReceiver
• Register receiver as handler for entity
   Use CAML or code
• Synchronous and asynchronous events
   ItemAdding
   ItemAdded
Sample Feature Receiver
public class Feature1EventReceiver : SPFeatureReceiver
{
    public override void FeatureActivated(SPFeatureReceiverProperties properties)
    {
        var web = properties.Feature.Parent as SPWeb;
        if (web == null) return;
        web.Properties["OldTitle"] = web.Title;
        web.Properties.Update();
        web.Title = "Feature activated at " + DateTime.Now.ToLongTimeString();
        web.Update();
    }

    public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
    {
        var web = properties.Feature.Parent as SPWeb;
        if (web == null) return;
        web.Title = web.Properties["OldTitle"];
        web.Update();
    }
}
DEMO
Event Handlers
Client Object Model
• API used when building remote applications
    Three entry points: .NET Managed, Silverlight, ECMAScript
    Alternative to SharePoint ASMX Web services
• Designed to be similar to the Server Object Model
• Types in COM generally named the same as SOM minus
  ‘SP’ prefix
• Methods and properties also named the same when
  possible
• Many SOM types or members are not available in COM
    Example: the COM does not have WebApplication or Farm types
Retrieving Resources using Load
• Retrieve object data in next batch
• Object properties loaded in-place
• Some properties not retrieved automatically
    Example: child collection properties
• Can explicitly indicate properties to retrieve
           var siteUrl = "http://localhost/sites/demo";
           var context = new ClientContext(siteUrl);
           var web = context.Web;
           context.Load(web, w => w.Title, w => w.Description);
           context.ExecuteQuery();
           Console.WriteLine(web.Title);
Retrieving Resources using LoadQuery
• Result of query included in next batch
• Returns enumerable result
       var query = from list in web.Lists.Include(l => l.Title)
                   where list.Hidden == false &&
                         list.ItemCount > 0
                   select list;
       var lists = context.LoadQuery(query);
Managed Client Object Model
<System Root>ISAPI
• Microsoft.SharePoint.Client
   281kb
• Microsoft.SharePoint.Client.Runtime
   145kb
To Compare:
   Microsoft.SharePoint.dll – 15.3MB
DEMO
Managed Client OM
Silverlight Client Object Model
• Very similar to the .NET managed implementation
• Silverlight controls can be hosted inside or outside
  SharePoint
    Affects how ClientContext is accessed
    In SharePoint Web Parts, site pages, and application pages
       Use ClientContext.Current
    In pages external to the SharePoint Web application
       Create new ClientContext
• Service calls must be made asynchronously
    ExecuteQueryAsync(succeededCallback, failedCallback)
Silverlight Client Object Model
<System Root>TEMPLATELAYOUTSClientBin
• Microsoft.SharePoint.Client.Silverlight
   262KB
• Microsoft.SharePoint.Client.Silverlight.Runtime
   138KB
Silverlight Client Object Model
private Web web;
private ClientContext context;

void MainPage_Loaded(object sender, RoutedEventArgs e) {
    context = ClientContent.Current;
    if (context == null)
        context = new ClientContext("http://localhost/sites/demo");
    web = context.Web;
    context.Load(web);
    context.ExecuteQueryAsync(Succeeded, Failed);
}

void Succeeded(object sender, ClientRequestSucceededEventArgs e) {
    Label1.Text = web.Title;
}

void Failed(object sender, ClientRequestFailedEventArgs e) {
    // handle error
}
JavaScript Client Object Model
• Similar to using .NET Managed/Silverlight implementations
    Different platform and different language so slightly different API
• Can only be used on pages running in the context of
  SharePoint
• Referenced using a SharePoint:ScriptLink control
    Use ScriptMode=“Debug” to use debug version of library
• To get intellisense, also add <script> tag
    Wrap in #if compiler directive so script isn’t loaded twice
• API uses conventions common in JavaScript libraries
    Camel-cased member names
    Properties implemented via get and set methods
JavaScript Client Object Model

• <System Root>TEMPLATELAYOUTS
• SP.js (SP.debug.js)
   380KB (559KB)
• SP.Core.js (SP.Core.debug.js)
   13KB (20KB)
• SP.Runtime.js (SP.Runtime.debug.js)
   68KB (108KB)
• Add using <SharePoint:ScriptLink>
JavaScript Client Object Model
<SharePoint:ScriptLink Name="sp.js" LoadAfterUI="true" Localizable="false"
    runat="server" ID="ScriptLink1" />
<SharePoint:ScriptLink Name="jquery-1.4.2.min.js" LoadAfterUI="true" Localizable="false"
    runat="server" ID="ScriptLink2" />

   <% #if ZZZZ %>
   <script type="text/javascript" src="/_layouts/SP.debug.js" />
   <script type="text/javascript" src="/_layouts/jquery-1.4.2-vsdoc.js" />
   <% #endif %>

<script type="text/javascript">
    _spBodyOnLoadFunctionNames.push("Initialize");

   var web;
   function Initialize() {
       var context = new SP.ClientContext.get_current();
       web = context.get_web();
       context.load(web);
       context.executeQueryAsync(Succeeded, Failed);
   }

   function Succeeded() { $("#listTitle").append(web.get_title()); }

    function Failed() { alert('request failed'); }
</script>
DEMO
JavaScript Client OM

More Related Content

What's hot

Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
SPTechCon
 
Automating SQL Server Database Creation for SharePoint
Automating SQL Server Database Creation for SharePointAutomating SQL Server Database Creation for SharePoint
Automating SQL Server Database Creation for SharePoint
Talbott Crowell
 
ECS19 - Laura Kokkarinen - Everything you need to know about SharePoint site ...
ECS19 - Laura Kokkarinen - Everything you need to know about SharePoint site ...ECS19 - Laura Kokkarinen - Everything you need to know about SharePoint site ...
ECS19 - Laura Kokkarinen - Everything you need to know about SharePoint site ...
European Collaboration Summit
 
Deep dive into SharePoint 2013 hosted apps - Chris OBrien
Deep dive into SharePoint 2013 hosted apps - Chris OBrienDeep dive into SharePoint 2013 hosted apps - Chris OBrien
Deep dive into SharePoint 2013 hosted apps - Chris OBrien
Chris O'Brien
 
Building SharePoint 2013 Apps - Architecture, Authentication & Connectivity API
Building SharePoint 2013 Apps - Architecture, Authentication & Connectivity APIBuilding SharePoint 2013 Apps - Architecture, Authentication & Connectivity API
Building SharePoint 2013 Apps - Architecture, Authentication & Connectivity API
SharePointRadi
 
SharePoint 2016 Adoption - Lessons Learned and Advanced Troubleshooting
SharePoint 2016 Adoption - Lessons Learned and Advanced TroubleshootingSharePoint 2016 Adoption - Lessons Learned and Advanced Troubleshooting
SharePoint 2016 Adoption - Lessons Learned and Advanced Troubleshooting
John Calvert
 
Get started with building native mobile apps interacting with SharePoint
Get started with building native mobile apps interacting with SharePointGet started with building native mobile apps interacting with SharePoint
Get started with building native mobile apps interacting with SharePoint
Yaroslav Pentsarskyy [MVP]
 
What’s new in SharePoint 2016 Beta 2?
What’s new in SharePoint 2016 Beta 2?What’s new in SharePoint 2016 Beta 2?
What’s new in SharePoint 2016 Beta 2?
Jason Himmelstein
 
Part II: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTe...
Part II: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTe...Part II: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTe...
Part II: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTe...
SPTechCon
 
Best Practices to SharePoint Architecture Fundamentals NZ & AUS
Best Practices to SharePoint Architecture Fundamentals NZ & AUSBest Practices to SharePoint Architecture Fundamentals NZ & AUS
Best Practices to SharePoint Architecture Fundamentals NZ & AUS
guest7c2e070
 
Getting started with microsoft office 365 share point online development
Getting started with microsoft office 365 share point online developmentGetting started with microsoft office 365 share point online development
Getting started with microsoft office 365 share point online development
Jeremy Thake
 
SharePoint On-Premises Nirvana
SharePoint On-Premises NirvanaSharePoint On-Premises Nirvana
SharePoint On-Premises Nirvana
John Calvert
 
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshopIntroduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Michael Blumenthal (Microsoft MVP)
 
SharePoint Performance: Best Practices from the Field
SharePoint Performance: Best Practices from the FieldSharePoint Performance: Best Practices from the Field
SharePoint Performance: Best Practices from the Field
Jason Himmelstein
 
O365Con18 - Site Templates, Site Life Cycle Management and Modern SharePoint ...
O365Con18 - Site Templates, Site Life Cycle Management and Modern SharePoint ...O365Con18 - Site Templates, Site Life Cycle Management and Modern SharePoint ...
O365Con18 - Site Templates, Site Life Cycle Management and Modern SharePoint ...
NCCOMMS
 
Set up an SharePoint On-Premises environment for developing provider-hosted a...
Set up an SharePoint On-Premises environment for developing provider-hosted a...Set up an SharePoint On-Premises environment for developing provider-hosted a...
Set up an SharePoint On-Premises environment for developing provider-hosted a...
SPC Adriatics
 
Developing SharePoint 2013 apps with Visual Studio 2012 - Microsoft TechDays ...
Developing SharePoint 2013 apps with Visual Studio 2012 - Microsoft TechDays ...Developing SharePoint 2013 apps with Visual Studio 2012 - Microsoft TechDays ...
Developing SharePoint 2013 apps with Visual Studio 2012 - Microsoft TechDays ...
Bram de Jager
 
Visio Services in SharePoint 2010
Visio Services in SharePoint 2010Visio Services in SharePoint 2010
Visio Services in SharePoint 2010
Alexander Meijers
 
SharePoint 2016 Platform Adoption Lessons Learned and Advanced Troubleshooting
SharePoint 2016 Platform Adoption   Lessons Learned and Advanced TroubleshootingSharePoint 2016 Platform Adoption   Lessons Learned and Advanced Troubleshooting
SharePoint 2016 Platform Adoption Lessons Learned and Advanced Troubleshooting
John Calvert
 
Back to the Basics: SharePoint Fundamentals by Joel Oleson
Back to the Basics: SharePoint Fundamentals by Joel OlesonBack to the Basics: SharePoint Fundamentals by Joel Oleson
Back to the Basics: SharePoint Fundamentals by Joel Oleson
Joel Oleson
 

What's hot (20)

Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
 
Automating SQL Server Database Creation for SharePoint
Automating SQL Server Database Creation for SharePointAutomating SQL Server Database Creation for SharePoint
Automating SQL Server Database Creation for SharePoint
 
ECS19 - Laura Kokkarinen - Everything you need to know about SharePoint site ...
ECS19 - Laura Kokkarinen - Everything you need to know about SharePoint site ...ECS19 - Laura Kokkarinen - Everything you need to know about SharePoint site ...
ECS19 - Laura Kokkarinen - Everything you need to know about SharePoint site ...
 
Deep dive into SharePoint 2013 hosted apps - Chris OBrien
Deep dive into SharePoint 2013 hosted apps - Chris OBrienDeep dive into SharePoint 2013 hosted apps - Chris OBrien
Deep dive into SharePoint 2013 hosted apps - Chris OBrien
 
Building SharePoint 2013 Apps - Architecture, Authentication & Connectivity API
Building SharePoint 2013 Apps - Architecture, Authentication & Connectivity APIBuilding SharePoint 2013 Apps - Architecture, Authentication & Connectivity API
Building SharePoint 2013 Apps - Architecture, Authentication & Connectivity API
 
SharePoint 2016 Adoption - Lessons Learned and Advanced Troubleshooting
SharePoint 2016 Adoption - Lessons Learned and Advanced TroubleshootingSharePoint 2016 Adoption - Lessons Learned and Advanced Troubleshooting
SharePoint 2016 Adoption - Lessons Learned and Advanced Troubleshooting
 
Get started with building native mobile apps interacting with SharePoint
Get started with building native mobile apps interacting with SharePointGet started with building native mobile apps interacting with SharePoint
Get started with building native mobile apps interacting with SharePoint
 
What’s new in SharePoint 2016 Beta 2?
What’s new in SharePoint 2016 Beta 2?What’s new in SharePoint 2016 Beta 2?
What’s new in SharePoint 2016 Beta 2?
 
Part II: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTe...
Part II: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTe...Part II: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTe...
Part II: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTe...
 
Best Practices to SharePoint Architecture Fundamentals NZ & AUS
Best Practices to SharePoint Architecture Fundamentals NZ & AUSBest Practices to SharePoint Architecture Fundamentals NZ & AUS
Best Practices to SharePoint Architecture Fundamentals NZ & AUS
 
Getting started with microsoft office 365 share point online development
Getting started with microsoft office 365 share point online developmentGetting started with microsoft office 365 share point online development
Getting started with microsoft office 365 share point online development
 
SharePoint On-Premises Nirvana
SharePoint On-Premises NirvanaSharePoint On-Premises Nirvana
SharePoint On-Premises Nirvana
 
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshopIntroduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
 
SharePoint Performance: Best Practices from the Field
SharePoint Performance: Best Practices from the FieldSharePoint Performance: Best Practices from the Field
SharePoint Performance: Best Practices from the Field
 
O365Con18 - Site Templates, Site Life Cycle Management and Modern SharePoint ...
O365Con18 - Site Templates, Site Life Cycle Management and Modern SharePoint ...O365Con18 - Site Templates, Site Life Cycle Management and Modern SharePoint ...
O365Con18 - Site Templates, Site Life Cycle Management and Modern SharePoint ...
 
Set up an SharePoint On-Premises environment for developing provider-hosted a...
Set up an SharePoint On-Premises environment for developing provider-hosted a...Set up an SharePoint On-Premises environment for developing provider-hosted a...
Set up an SharePoint On-Premises environment for developing provider-hosted a...
 
Developing SharePoint 2013 apps with Visual Studio 2012 - Microsoft TechDays ...
Developing SharePoint 2013 apps with Visual Studio 2012 - Microsoft TechDays ...Developing SharePoint 2013 apps with Visual Studio 2012 - Microsoft TechDays ...
Developing SharePoint 2013 apps with Visual Studio 2012 - Microsoft TechDays ...
 
Visio Services in SharePoint 2010
Visio Services in SharePoint 2010Visio Services in SharePoint 2010
Visio Services in SharePoint 2010
 
SharePoint 2016 Platform Adoption Lessons Learned and Advanced Troubleshooting
SharePoint 2016 Platform Adoption   Lessons Learned and Advanced TroubleshootingSharePoint 2016 Platform Adoption   Lessons Learned and Advanced Troubleshooting
SharePoint 2016 Platform Adoption Lessons Learned and Advanced Troubleshooting
 
Back to the Basics: SharePoint Fundamentals by Joel Oleson
Back to the Basics: SharePoint Fundamentals by Joel OlesonBack to the Basics: SharePoint Fundamentals by Joel Oleson
Back to the Basics: SharePoint Fundamentals by Joel Oleson
 

Viewers also liked

Tutorial, Part 1: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 1: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 1: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 1: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
SPTechCon
 
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
SPTechCon
 
Introduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST APIIntroduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST API
Rob Windsor
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010
Rob Windsor
 
SharePoint 2010 Application Development Overview
SharePoint 2010 Application Development OverviewSharePoint 2010 Application Development Overview
SharePoint 2010 Application Development Overview
Rob Windsor
 
Integrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio LightswitchIntegrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio Lightswitch
Rob Windsor
 

Viewers also liked (6)

Tutorial, Part 1: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 1: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 1: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 1: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
 
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
 
Introduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST APIIntroduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST API
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010
 
SharePoint 2010 Application Development Overview
SharePoint 2010 Application Development OverviewSharePoint 2010 Application Development Overview
SharePoint 2010 Application Development Overview
 
Integrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio LightswitchIntegrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio Lightswitch
 

Similar to Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor - SPTec…

SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...
Liam Cleary [MVP]
 
SharePoint 2013 APIs
SharePoint 2013 APIsSharePoint 2013 APIs
SharePoint 2013 APIs
John Calvert
 
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
Luis Du Solier
 
Building dynamic applications with the share point client object model
Building dynamic applications with the share point client object modelBuilding dynamic applications with the share point client object model
Building dynamic applications with the share point client object model
Eric Shupps
 
Introduction to the Client OM in SharePoint 2010
Introduction to the Client OM in SharePoint 2010Introduction to the Client OM in SharePoint 2010
Introduction to the Client OM in SharePoint 2010
Ben Robb
 
StackMate - CloudFormation for CloudStack
StackMate - CloudFormation for CloudStackStackMate - CloudFormation for CloudStack
StackMate - CloudFormation for CloudStack
Chiradeep Vittal
 
AWS Lambda in C#
AWS Lambda in C#AWS Lambda in C#
AWS Lambda in C#
Amazon Web Services
 
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
SPTechCon
 
NEW LAUNCH! Developing Serverless C# Applications
NEW LAUNCH! Developing Serverless C# ApplicationsNEW LAUNCH! Developing Serverless C# Applications
NEW LAUNCH! Developing Serverless C# Applications
Amazon Web Services
 
Migrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
Migrate your Existing Express Apps to AWS Lambda and Amazon API GatewayMigrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
Migrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
Amazon Web Services
 
Ajax workshop
Ajax workshopAjax workshop
Ajax workshop
WBUTTUTORIALS
 
Charla desarrollo de apps con sharepoint y office 365
Charla   desarrollo de apps con sharepoint y office 365Charla   desarrollo de apps con sharepoint y office 365
Charla desarrollo de apps con sharepoint y office 365
Luis Valencia
 
ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0
Ido Flatow
 
Apex Code Analysis Using the Tooling API and Canvas
Apex Code Analysis Using the Tooling API and CanvasApex Code Analysis Using the Tooling API and Canvas
Apex Code Analysis Using the Tooling API and Canvas
Salesforce Developers
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
Sam Brannen
 
Code First with Serverless Azure Functions
Code First with Serverless Azure FunctionsCode First with Serverless Azure Functions
Code First with Serverless Azure Functions
Jeremy Likness
 
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Amazon Web Services
 
SharePoint Object Model, Web Services and Events
SharePoint Object Model, Web Services and EventsSharePoint Object Model, Web Services and Events
SharePoint Object Model, Web Services and Events
Mohan Arumugam
 
Ajax
AjaxAjax
Java-Web-Applications.pdf
Java-Web-Applications.pdfJava-Web-Applications.pdf
Java-Web-Applications.pdf
ssuserf2dc4c1
 

Similar to Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor - SPTec… (20)

SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...
 
SharePoint 2013 APIs
SharePoint 2013 APIsSharePoint 2013 APIs
SharePoint 2013 APIs
 
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
 
Building dynamic applications with the share point client object model
Building dynamic applications with the share point client object modelBuilding dynamic applications with the share point client object model
Building dynamic applications with the share point client object model
 
Introduction to the Client OM in SharePoint 2010
Introduction to the Client OM in SharePoint 2010Introduction to the Client OM in SharePoint 2010
Introduction to the Client OM in SharePoint 2010
 
StackMate - CloudFormation for CloudStack
StackMate - CloudFormation for CloudStackStackMate - CloudFormation for CloudStack
StackMate - CloudFormation for CloudStack
 
AWS Lambda in C#
AWS Lambda in C#AWS Lambda in C#
AWS Lambda in C#
 
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
 
NEW LAUNCH! Developing Serverless C# Applications
NEW LAUNCH! Developing Serverless C# ApplicationsNEW LAUNCH! Developing Serverless C# Applications
NEW LAUNCH! Developing Serverless C# Applications
 
Migrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
Migrate your Existing Express Apps to AWS Lambda and Amazon API GatewayMigrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
Migrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
 
Ajax workshop
Ajax workshopAjax workshop
Ajax workshop
 
Charla desarrollo de apps con sharepoint y office 365
Charla   desarrollo de apps con sharepoint y office 365Charla   desarrollo de apps con sharepoint y office 365
Charla desarrollo de apps con sharepoint y office 365
 
ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0
 
Apex Code Analysis Using the Tooling API and Canvas
Apex Code Analysis Using the Tooling API and CanvasApex Code Analysis Using the Tooling API and Canvas
Apex Code Analysis Using the Tooling API and Canvas
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
 
Code First with Serverless Azure Functions
Code First with Serverless Azure FunctionsCode First with Serverless Azure Functions
Code First with Serverless Azure Functions
 
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
 
SharePoint Object Model, Web Services and Events
SharePoint Object Model, Web Services and EventsSharePoint Object Model, Web Services and Events
SharePoint Object Model, Web Services and Events
 
Ajax
AjaxAjax
Ajax
 
Java-Web-Applications.pdf
Java-Web-Applications.pdfJava-Web-Applications.pdf
Java-Web-Applications.pdf
 

More from SPTechCon

Deep Dive into the Content Query Web Part by Christina Wheeler - SPTechCon
Deep Dive into the Content Query Web Part by Christina Wheeler - SPTechConDeep Dive into the Content Query Web Part by Christina Wheeler - SPTechCon
Deep Dive into the Content Query Web Part by Christina Wheeler - SPTechCon
SPTechCon
 
NOW I Get It... What SharePoint Is, and Why My Business Needs It by Mark Rack...
NOW I Get It... What SharePoint Is, and Why My Business Needs It by Mark Rack...NOW I Get It... What SharePoint Is, and Why My Business Needs It by Mark Rack...
NOW I Get It... What SharePoint Is, and Why My Business Needs It by Mark Rack...
SPTechCon
 
“Managing Up” in Difficult Situations by Bill English - SPTechCon
“Managing Up” in Difficult Situations by Bill English - SPTechCon“Managing Up” in Difficult Situations by Bill English - SPTechCon
“Managing Up” in Difficult Situations by Bill English - SPTechCon
SPTechCon
 
Part I: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTec...
Part I: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTec...Part I: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTec...
Part I: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTec...
SPTechCon
 
Microsoft Keynote by Richard Riley - SPTechCon
Microsoft Keynote by Richard Riley - SPTechConMicrosoft Keynote by Richard Riley - SPTechCon
Microsoft Keynote by Richard Riley - SPTechCon
SPTechCon
 
Ten Best SharePoint Features You’ve Never Used by Christian Buckley - SPTechCon
Ten Best SharePoint Features You’ve Never Used by Christian Buckley - SPTechConTen Best SharePoint Features You’ve Never Used by Christian Buckley - SPTechCon
Ten Best SharePoint Features You’ve Never Used by Christian Buckley - SPTechCon
SPTechCon
 
Looking Under the Hood: How Your Metadata Strategy Impacts Everything You Do ...
Looking Under the Hood: How Your Metadata Strategy Impacts Everything You Do ...Looking Under the Hood: How Your Metadata Strategy Impacts Everything You Do ...
Looking Under the Hood: How Your Metadata Strategy Impacts Everything You Do ...
SPTechCon
 
Law & Order: Content Governance Strategies by Chrisitan Buckley - SPTechCon
Law & Order: Content Governance Strategies by Chrisitan Buckley - SPTechConLaw & Order: Content Governance Strategies by Chrisitan Buckley - SPTechCon
Law & Order: Content Governance Strategies by Chrisitan Buckley - SPTechCon
SPTechCon
 
What IS SharePoint Development? by Mark Rackley - SPTechCon
 What IS SharePoint Development? by Mark Rackley - SPTechCon What IS SharePoint Development? by Mark Rackley - SPTechCon
What IS SharePoint Development? by Mark Rackley - SPTechCon
SPTechCon
 
The SharePoint and jQuery Guide by Mark Rackley - SPTechCon
The SharePoint and jQuery Guide by Mark Rackley - SPTechConThe SharePoint and jQuery Guide by Mark Rackley - SPTechCon
The SharePoint and jQuery Guide by Mark Rackley - SPTechCon
SPTechCon
 
Understanding and Implementing Governance for SharePoint 2010 by Bill English...
Understanding and Implementing Governance for SharePoint 2010 by Bill English...Understanding and Implementing Governance for SharePoint 2010 by Bill English...
Understanding and Implementing Governance for SharePoint 2010 by Bill English...
SPTechCon
 
Integrate External Data with the Business Connectivity Services by Tom Resing...
Integrate External Data with the Business Connectivity Services by Tom Resing...Integrate External Data with the Business Connectivity Services by Tom Resing...
Integrate External Data with the Business Connectivity Services by Tom Resing...
SPTechCon
 
Converting an E-mail Culture into a SharePoint Culture by Robert Bogue - SPTe...
Converting an E-mail Culture into a SharePoint Culture by Robert Bogue - SPTe...Converting an E-mail Culture into a SharePoint Culture by Robert Bogue - SPTe...
Converting an E-mail Culture into a SharePoint Culture by Robert Bogue - SPTe...
SPTechCon
 
Tutorial: Best Practices for Building a Records-Management Deployment in Shar...
Tutorial: Best Practices for Building a Records-Management Deployment in Shar...Tutorial: Best Practices for Building a Records-Management Deployment in Shar...
Tutorial: Best Practices for Building a Records-Management Deployment in Shar...
SPTechCon
 
Tutorial: Building Business Solutions: InfoPath & Workflows by Jennifer Mason...
Tutorial: Building Business Solutions: InfoPath & Workflows by Jennifer Mason...Tutorial: Building Business Solutions: InfoPath & Workflows by Jennifer Mason...
Tutorial: Building Business Solutions: InfoPath & Workflows by Jennifer Mason...
SPTechCon
 
Creating Simple Dashboards Using Out-of-the-Box Web Parts by Jennifer Mason- ...
Creating Simple Dashboards Using Out-of-the-Box Web Parts by Jennifer Mason- ...Creating Simple Dashboards Using Out-of-the-Box Web Parts by Jennifer Mason- ...
Creating Simple Dashboards Using Out-of-the-Box Web Parts by Jennifer Mason- ...
SPTechCon
 
Sponsored Session: Better Document Management Using SharePoint by Roland Simo...
Sponsored Session: Better Document Management Using SharePoint by Roland Simo...Sponsored Session: Better Document Management Using SharePoint by Roland Simo...
Sponsored Session: Better Document Management Using SharePoint by Roland Simo...
SPTechCon
 
Sponsored Session: The Missing Link: Content-Aware Integration to SharePoint ...
Sponsored Session: The Missing Link: Content-Aware Integration to SharePoint ...Sponsored Session: The Missing Link: Content-Aware Integration to SharePoint ...
Sponsored Session: The Missing Link: Content-Aware Integration to SharePoint ...
SPTechCon
 
Creating a Great User Experience in SharePoint by Marc Anderson - SPTechCon
Creating a Great User Experience in SharePoint by Marc Anderson - SPTechConCreating a Great User Experience in SharePoint by Marc Anderson - SPTechCon
Creating a Great User Experience in SharePoint by Marc Anderson - SPTechCon
SPTechCon
 
Sponsored Session: Driving the business case and user adoption for SharePoint...
Sponsored Session: Driving the business case and user adoption for SharePoint...Sponsored Session: Driving the business case and user adoption for SharePoint...
Sponsored Session: Driving the business case and user adoption for SharePoint...
SPTechCon
 

More from SPTechCon (20)

Deep Dive into the Content Query Web Part by Christina Wheeler - SPTechCon
Deep Dive into the Content Query Web Part by Christina Wheeler - SPTechConDeep Dive into the Content Query Web Part by Christina Wheeler - SPTechCon
Deep Dive into the Content Query Web Part by Christina Wheeler - SPTechCon
 
NOW I Get It... What SharePoint Is, and Why My Business Needs It by Mark Rack...
NOW I Get It... What SharePoint Is, and Why My Business Needs It by Mark Rack...NOW I Get It... What SharePoint Is, and Why My Business Needs It by Mark Rack...
NOW I Get It... What SharePoint Is, and Why My Business Needs It by Mark Rack...
 
“Managing Up” in Difficult Situations by Bill English - SPTechCon
“Managing Up” in Difficult Situations by Bill English - SPTechCon“Managing Up” in Difficult Situations by Bill English - SPTechCon
“Managing Up” in Difficult Situations by Bill English - SPTechCon
 
Part I: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTec...
Part I: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTec...Part I: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTec...
Part I: SharePoint 2013 Administration by Todd Klindt and Shane Young - SPTec...
 
Microsoft Keynote by Richard Riley - SPTechCon
Microsoft Keynote by Richard Riley - SPTechConMicrosoft Keynote by Richard Riley - SPTechCon
Microsoft Keynote by Richard Riley - SPTechCon
 
Ten Best SharePoint Features You’ve Never Used by Christian Buckley - SPTechCon
Ten Best SharePoint Features You’ve Never Used by Christian Buckley - SPTechConTen Best SharePoint Features You’ve Never Used by Christian Buckley - SPTechCon
Ten Best SharePoint Features You’ve Never Used by Christian Buckley - SPTechCon
 
Looking Under the Hood: How Your Metadata Strategy Impacts Everything You Do ...
Looking Under the Hood: How Your Metadata Strategy Impacts Everything You Do ...Looking Under the Hood: How Your Metadata Strategy Impacts Everything You Do ...
Looking Under the Hood: How Your Metadata Strategy Impacts Everything You Do ...
 
Law & Order: Content Governance Strategies by Chrisitan Buckley - SPTechCon
Law & Order: Content Governance Strategies by Chrisitan Buckley - SPTechConLaw & Order: Content Governance Strategies by Chrisitan Buckley - SPTechCon
Law & Order: Content Governance Strategies by Chrisitan Buckley - SPTechCon
 
What IS SharePoint Development? by Mark Rackley - SPTechCon
 What IS SharePoint Development? by Mark Rackley - SPTechCon What IS SharePoint Development? by Mark Rackley - SPTechCon
What IS SharePoint Development? by Mark Rackley - SPTechCon
 
The SharePoint and jQuery Guide by Mark Rackley - SPTechCon
The SharePoint and jQuery Guide by Mark Rackley - SPTechConThe SharePoint and jQuery Guide by Mark Rackley - SPTechCon
The SharePoint and jQuery Guide by Mark Rackley - SPTechCon
 
Understanding and Implementing Governance for SharePoint 2010 by Bill English...
Understanding and Implementing Governance for SharePoint 2010 by Bill English...Understanding and Implementing Governance for SharePoint 2010 by Bill English...
Understanding and Implementing Governance for SharePoint 2010 by Bill English...
 
Integrate External Data with the Business Connectivity Services by Tom Resing...
Integrate External Data with the Business Connectivity Services by Tom Resing...Integrate External Data with the Business Connectivity Services by Tom Resing...
Integrate External Data with the Business Connectivity Services by Tom Resing...
 
Converting an E-mail Culture into a SharePoint Culture by Robert Bogue - SPTe...
Converting an E-mail Culture into a SharePoint Culture by Robert Bogue - SPTe...Converting an E-mail Culture into a SharePoint Culture by Robert Bogue - SPTe...
Converting an E-mail Culture into a SharePoint Culture by Robert Bogue - SPTe...
 
Tutorial: Best Practices for Building a Records-Management Deployment in Shar...
Tutorial: Best Practices for Building a Records-Management Deployment in Shar...Tutorial: Best Practices for Building a Records-Management Deployment in Shar...
Tutorial: Best Practices for Building a Records-Management Deployment in Shar...
 
Tutorial: Building Business Solutions: InfoPath & Workflows by Jennifer Mason...
Tutorial: Building Business Solutions: InfoPath & Workflows by Jennifer Mason...Tutorial: Building Business Solutions: InfoPath & Workflows by Jennifer Mason...
Tutorial: Building Business Solutions: InfoPath & Workflows by Jennifer Mason...
 
Creating Simple Dashboards Using Out-of-the-Box Web Parts by Jennifer Mason- ...
Creating Simple Dashboards Using Out-of-the-Box Web Parts by Jennifer Mason- ...Creating Simple Dashboards Using Out-of-the-Box Web Parts by Jennifer Mason- ...
Creating Simple Dashboards Using Out-of-the-Box Web Parts by Jennifer Mason- ...
 
Sponsored Session: Better Document Management Using SharePoint by Roland Simo...
Sponsored Session: Better Document Management Using SharePoint by Roland Simo...Sponsored Session: Better Document Management Using SharePoint by Roland Simo...
Sponsored Session: Better Document Management Using SharePoint by Roland Simo...
 
Sponsored Session: The Missing Link: Content-Aware Integration to SharePoint ...
Sponsored Session: The Missing Link: Content-Aware Integration to SharePoint ...Sponsored Session: The Missing Link: Content-Aware Integration to SharePoint ...
Sponsored Session: The Missing Link: Content-Aware Integration to SharePoint ...
 
Creating a Great User Experience in SharePoint by Marc Anderson - SPTechCon
Creating a Great User Experience in SharePoint by Marc Anderson - SPTechConCreating a Great User Experience in SharePoint by Marc Anderson - SPTechCon
Creating a Great User Experience in SharePoint by Marc Anderson - SPTechCon
 
Sponsored Session: Driving the business case and user adoption for SharePoint...
Sponsored Session: Driving the business case and user adoption for SharePoint...Sponsored Session: Driving the business case and user adoption for SharePoint...
Sponsored Session: Driving the business case and user adoption for SharePoint...
 

Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor - SPTec…

  • 1. Working with the SharePoint Object Models Rob Windsor rwindsor@portalsolutions.net @robwindsor
  • 2. SharePoint Developer APIs • Server Object Model  Used by client apps running on SP server • Client Object Models (CSOM)  Remote API  Three entry points: .NET Managed, Silverlight, JavaScript  Façade layer on top of WCF service  Uses batching model to access resources • REST Web Services (API)  SP 2010: CRUD on list data only  SP 2013: API expanded to be more like CSOM • SharePoint Web Services  “Legacy” SOAP-based web services
  • 3. Server Object Model • Can be used when “in the context” of SharePoint  Code-behind, event handlers, timer jobs  ASP.NET applications running in same app. pool  Client applications that run on SharePoint servers • API implemented in Microsoft.SharePoint.dll • Core types map to main SharePoint components  SPSite, SPWeb, SPList, SPDocumentLibrary, SPListItem  SPContext gives access to current context
  • 4. Server Object Model • The SharePoint version of “Hello, World”  Show the root site of a collection and it’s lists using (var site = new SPSite("http://localhost/sites/demo/")) { var web = site.RootWeb; ListBox1.Items.Add(web.Title); foreach (SPList list in web.Lists) { ListBox1.Items.Add("t" + list.Title); } }
  • 5. Resource Usage • SPSite and SPWeb objects use unmanaged resources  Vital that you release resources with Dispose • General rules:  If you create the object, you should Dispose  var site = new SPSite(“http://localhost”);  var web = site.OpenWeb();  If you get a reference from a property, don’t Dispose  var web = site.RootWeb  There are exceptions to these rules • Use SPDisposeCheck to analyze code
  • 7. Event Handlers • Override methods on known receiver types  SPFeatureReceiver  SPListEventReceiver  SPItemEventReceiver • Register receiver as handler for entity  Use CAML or code • Synchronous and asynchronous events  ItemAdding  ItemAdded
  • 8. Sample Feature Receiver public class Feature1EventReceiver : SPFeatureReceiver { public override void FeatureActivated(SPFeatureReceiverProperties properties) { var web = properties.Feature.Parent as SPWeb; if (web == null) return; web.Properties["OldTitle"] = web.Title; web.Properties.Update(); web.Title = "Feature activated at " + DateTime.Now.ToLongTimeString(); web.Update(); } public override void FeatureDeactivating(SPFeatureReceiverProperties properties) { var web = properties.Feature.Parent as SPWeb; if (web == null) return; web.Title = web.Properties["OldTitle"]; web.Update(); } }
  • 10. Client Object Model • API used when building remote applications  Three entry points: .NET Managed, Silverlight, ECMAScript  Alternative to SharePoint ASMX Web services • Designed to be similar to the Server Object Model • Types in COM generally named the same as SOM minus ‘SP’ prefix • Methods and properties also named the same when possible • Many SOM types or members are not available in COM  Example: the COM does not have WebApplication or Farm types
  • 11. Retrieving Resources using Load • Retrieve object data in next batch • Object properties loaded in-place • Some properties not retrieved automatically  Example: child collection properties • Can explicitly indicate properties to retrieve var siteUrl = "http://localhost/sites/demo"; var context = new ClientContext(siteUrl); var web = context.Web; context.Load(web, w => w.Title, w => w.Description); context.ExecuteQuery(); Console.WriteLine(web.Title);
  • 12. Retrieving Resources using LoadQuery • Result of query included in next batch • Returns enumerable result var query = from list in web.Lists.Include(l => l.Title) where list.Hidden == false && list.ItemCount > 0 select list; var lists = context.LoadQuery(query);
  • 13. Managed Client Object Model <System Root>ISAPI • Microsoft.SharePoint.Client  281kb • Microsoft.SharePoint.Client.Runtime  145kb To Compare:  Microsoft.SharePoint.dll – 15.3MB
  • 15. Silverlight Client Object Model • Very similar to the .NET managed implementation • Silverlight controls can be hosted inside or outside SharePoint  Affects how ClientContext is accessed  In SharePoint Web Parts, site pages, and application pages  Use ClientContext.Current  In pages external to the SharePoint Web application  Create new ClientContext • Service calls must be made asynchronously  ExecuteQueryAsync(succeededCallback, failedCallback)
  • 16. Silverlight Client Object Model <System Root>TEMPLATELAYOUTSClientBin • Microsoft.SharePoint.Client.Silverlight  262KB • Microsoft.SharePoint.Client.Silverlight.Runtime  138KB
  • 17. Silverlight Client Object Model private Web web; private ClientContext context; void MainPage_Loaded(object sender, RoutedEventArgs e) { context = ClientContent.Current; if (context == null) context = new ClientContext("http://localhost/sites/demo"); web = context.Web; context.Load(web); context.ExecuteQueryAsync(Succeeded, Failed); } void Succeeded(object sender, ClientRequestSucceededEventArgs e) { Label1.Text = web.Title; } void Failed(object sender, ClientRequestFailedEventArgs e) { // handle error }
  • 18. JavaScript Client Object Model • Similar to using .NET Managed/Silverlight implementations  Different platform and different language so slightly different API • Can only be used on pages running in the context of SharePoint • Referenced using a SharePoint:ScriptLink control  Use ScriptMode=“Debug” to use debug version of library • To get intellisense, also add <script> tag  Wrap in #if compiler directive so script isn’t loaded twice • API uses conventions common in JavaScript libraries  Camel-cased member names  Properties implemented via get and set methods
  • 19. JavaScript Client Object Model • <System Root>TEMPLATELAYOUTS • SP.js (SP.debug.js)  380KB (559KB) • SP.Core.js (SP.Core.debug.js)  13KB (20KB) • SP.Runtime.js (SP.Runtime.debug.js)  68KB (108KB) • Add using <SharePoint:ScriptLink>
  • 20. JavaScript Client Object Model <SharePoint:ScriptLink Name="sp.js" LoadAfterUI="true" Localizable="false" runat="server" ID="ScriptLink1" /> <SharePoint:ScriptLink Name="jquery-1.4.2.min.js" LoadAfterUI="true" Localizable="false" runat="server" ID="ScriptLink2" /> <% #if ZZZZ %> <script type="text/javascript" src="/_layouts/SP.debug.js" /> <script type="text/javascript" src="/_layouts/jquery-1.4.2-vsdoc.js" /> <% #endif %> <script type="text/javascript"> _spBodyOnLoadFunctionNames.push("Initialize"); var web; function Initialize() { var context = new SP.ClientContext.get_current(); web = context.get_web(); context.load(web); context.executeQueryAsync(Succeeded, Failed); } function Succeeded() { $("#listTitle").append(web.get_title()); } function Failed() { alert('request failed'); } </script>