SHAREPOINT AND PROJECT CONFERENCE ADRIATICS 2013
ZAGREB, NOVEMBER 27-28 2013
SharePoint 2013 APIs demystified
JOŠKO IVANKOV, EVISION
sponsors
Agenda• About SharePoint• SharePoint APIs history• SharePoint 2013 API overview• What API to choose• SharePoint Apps overview• SharePoint Dev environment• Key Takeaways• Q&A
What is SharePoint?• It’s web & intranet platform for…• Collaboration• Enterprise Content Management• Search• Business Process Management (Workflows)• Business Intelligence• Social Computing• Enterprise Application Integration
• More than 50% of intranets in the world use SharePoint!!!
Why SharePoint?• Worldwide used product and platform
• Leading platform for ECM, BPM, BI and Social Computing
• On premise and Cloud ready
• Standardized and widely accepted functionalities
• Lot’s of Out-Of-The-Box features and platform for creating your own applications
What is SharePoint Development?
• SharePoint Configuration• Internet ExplorerEnd user• XML, XSL, JavaScript, jQuery, UI
Config• SharePoint designer
Power user
• Master Page, Page layout, CSS• SharePoint designerDesigner
• SSOM, CSOM, .NET, JS, REST• Visual Studio
Developer
One day in life of SharePoint developer• Server side OM• Client side OM• JavaScript• Rest• WCF (SOAP, OData)• HTML, CSS• XML, XSLT• jQuery• TypeScript• Oauth
• NTLM, Kerberos• FBA authentication• Claims• InfoPath forms• Azure ACS• AppFabric Cache• Windows RT• Windows Phone• Workflow Foundation• Silverlight
Development overview
Client Side• Client Object
Model• REST
Services
Data Platform• Farm• Sites• List data• External lists
Server side• Server Side
Object Model
APIs – History: SharePoint 2007• Server-side object model• RPC Calls (owssrc.dll)• ASMX Web Services (The only client side possibility)• SPServices (Community Project based on ASMX services)
APIs – History: SharePoint 2010• Server Side object model• RPC Calls (owssrc.dll)• ASMX Web Services• SPServices (Community Project based on ASMX services)
• ListData.svc (REST-like web service)• Client Side Object Model
APIs – SharePoint 2013• Server Side Object Model• RPC Calls (owssrc.dll)• ASMX Web Services
• Client-Side Object Model (extended)• New REST APIs
Sever object model• Largest API set• Cover all functionalities of SharePoint – both end user and
administrative
• Microsoft.SharePoint… namespace
• Assemblies are deployed to GAC
• On premises use only
• Sandboxed solutions are deprecated in favor of Apps for SharePoint
Sever object model - example
Server object model – remember• Code that use SharePoint data platform (SPSite, SPWeb,
SPList, SPListItem, SPFile …) should be on SharePoint server with Front End role
• Use WSP – easier to deploy and maintain
• Check disposing of SharePoint objects
• Use it for Web Parts, Layout pages, Timer jobs, EventReceivers, custom WCF/ASMX on SharePoint server,
• On premises only!!!
SharePoint 2013 Remote API Architecture
Client object model for managed code• .NET client object model
• .NET application that run on a non-phone Windows client• user computer• external server • web or worker role on Windows Azure
• Core classes in SSOM have corresponding classes in CSOM• SPSite -> Site• SPWeb -> Web• SPList -> List
• Support for ECM, taxonomy, user profiles, publishing, search, BCS…
• Lines of code are sent to the server in batches (to improve performance)
• Install SharePoint client components• Namespace Microsoft.SharePoint.Client
Client object model for managed code• Silverlight client object model• Used in Silverlight applications regardless where the
compiled .xap file is persisted• Assets library on SharePoint 2013 site• Client computer• Cloud storage• External server
• Nearly identical to .NET Client object model• Difference: in Silverlight version all batches of commands are sent to
the server asynchronously -> UI of the application remains active
• Silverlight .xap files can be included in Apps for SharePoint
Client object model for managed code• Mobile object model
• Special version of the Silverlight client object model for Windows Phone devices
• Additional API – relevant only to telephones (push notifications…)
• Supports only core SharePoint functionalities
• Support for ECM, taxonomy, user profiles, publishing, search, BCS…
JavaScript object model• Inline script or separate .js files
• Includes all the same functionality as the .NET Framework and Silverlight client object models
• Batches of code always run asynchronously
• Data is returned from the server in JavaScript Object Notation (JSON)
Client Object Model Mechanics
Changes to CSOM in SharePoint 2013
CSOM using Managed Code
CSOM using JavaScript
REST/OData endpoints• Access SharePoint entities from client technology that
do not use JavaScript and are not built on the .NET Framework or Silverlight platforms
• CRUD operations on SharePoint list data using OData protocol
• Response: Atom or JSON format
REST mechanics
REST URLs in SharePoint 2013
Mapping Objects to Resources
Testing REST Calls Through the Browser
Returning ATOM XML vs. JSON
REST Query from Managed Code
REST Query Using JavaScript & jQuery
Factors that determine which API to use• The type of application• SharePoint App, Web Part, Silverlight application, timer job…
• Your existing skill• JavaScript, ASP.NET, REST/OData, Silverlight, Windows Phone…
• The device on which the code runs• Server in the SharePoint farm, external server, a client
computer, mobile device…
What API to use?
If you want to do this• Create an ASP.NET web application that performs
create/read/update/deleted (CRUD) operations across a firewall on SharePoint data or external data that is surfaced in SharePoint by a Microsoft Business Connectivity Services (BCS) external content type
…use these APIs• JavaScript client object model
If you want to do this• Create an ASP.NET web application that performs CRUD
operations on SharePoint data or external data that is surfaced in SharePoint by a BCS external content type, but does not have to call SharePoint across a firewall
…use these APIs• .NET Framework client object model, Silverlight client
object model, or REST/OData endpoints
If you want to do this• Create a LAMP web application that performs CRUD
operations on SharePoint data or external data that is surfaced in SharePoint by a BCS external content type
…use these APIs• REST/OData endpoints
If you want to do this• Create a Windows Phone app that performs CRUD
operations on SharePoint data
…use these APIs• Mobile client object model
If you want to do this• Create an iOS or Android app that performs CRUD
operations on SharePoint data
…use these APIs• REST/OData endpoints
If you want to do this• Create a .NET Framework application that performs
CRUD operations on SharePoint data
…use these APIs• .NET Framework client object model
If you want to do this• Create a Silverlight application that performs CRUD
operations on SharePoint data
…use these APIs• Silverlight client object model
If you want to do this• Create an HTML/JavaScript application that performs
CRUD operations on SharePoint data
…use these APIs• JavaScript client object model
If you want to do this• Create an app for Office that works with SharePoint
…use these APIs• JavaScript client object model
If you want to do this• Create a custom Windows PowerShell command
…use these APIs• Server object model
If you want to do this• Create a timer job
…use these APIs• Server object model
If you want to do this• Create a custom Web Part, application page, or ASP.NET
user control
…use these APIs• Server object model
What to chose?
SharePoint Server Side Object Model
SharePoint extensions
SharePoint Data models Web parts
Application Pages
Event Handlers Timer Jobs
Business Connectivity
Services
Service Applications ...
Farm Solutions
SharePoint customizati
ons
Admin stuff
What to chose?
SharePoint Server Side Object Model
PowerShell Client Object Model REST API
Admin stuff
Communicate with SharePoint from outer world
What to chose?
SharePoint Server Side Object Model
PowerShell Client Object Model REST API
CLR SL WP ECMA *
.net Applications
Silverlight Applications
Windows Phone
applications
JavaScript (in
SharePoint pages)
SharePoint Apps Office Apps iOS, Android *
SharePoint solution types with SP 2013
SandboxFarm solutions
Declarative elements
Partially trusted code service still included for limited server side support
Full trust solutions
Customizations to file system of servers
Classic model from 2007
New Apps model
Deployed from corporate catalog or office market place
Manage permission and licenses specifically
Preferred option
SP Apps31 2
apps…• …are not executed in SharePoint App pool• …are in most of the cases not even running on SP
Server• …can have full trust, with user’s approval (OAuth)• …can access SharePoint Data• …can access outer world non-SharePoint Data• …can use any external resources• …can be executed in it’s own chrome, as app parts, or
as SharePoint extensions
why apps• Isolated (safe!)• Multi-tenant• Multiple development possibilities (even non-MS stack)• Easier to deploy• Easier to maintain (lifecycle – versioning, upgrades)• Manageable (SharePoint Marketplace, Corporate
Catalog)
• Cloud ready!
SP App design - a choice of three approaches
App Web (from WSP)
Parent Web
SharePoint-hosted App
Provision an isolated sub web on a parent web• Reuse web elements
(lists, files, out-of-box web parts)• No server code allowed; use
client JavaScript for logic, UX
Azure Auto-Hosted App
Windows Azure + SQL Azure provisioned invisibly as apps are installed
Azure (from
WebDeploy, DacPac)
SharePoint Web
Get remote events from SharePoint Use CSOM/REST + OAuth to work with SP
Cloud-based Apps
Provider-Hosted App
“Bring your own server hosting infrastructure”Developers will need to isolate tenants
SharePoint Web
Your Hosted Site
Types of Apps for SharePoint
Shape Description Example
Immersive App(Full Page)
App that implements a new scenario for customers
Resource Tracking, Budgeting
App Part Provides new parts you can add to your sites
Weather, Team Mascot, News
Extension App(Custom Action)
Add new actions for documents and items
Display Document Visualization, Print to Print Service Vendor
Development environment for SharePoint 2013
• Create solutions with server side object model or develop apps for SharePoint for a corporate catalog (full control permission)• VM
• Windows Server 2008 R2(SP1)/2012• SQL Server 2008 R2/2012 (Express/Standard/Enterprise)• SharePoint 2013 Foundation/Standard/Enterprise• Visual Studio 2012, SharePoint Designer 2013, Office 2013
• Create and publish apps for SharePoint• Get Office365 Developer site
• NAPA / Visual Studio 2012
Key Takeaways• SharePoint is leading IWS solution
• SharePoint development is complex but worthy
• Invest time in choosing right technology and approach for SharePoint development
• SharePoint Apps – be prepared for new trend
• SaaS, Cloud – dominate trends in future
thank you.
SHAREPOINT AND PROJECT CONFERENCE ADRIATICS 2013
ZAGREB, NOVEMBER 27-28 2013