Top Banner
SHAREPOINT AND PROJECT CONFERENCE ADRIATICS 2013 ZAGREB, NOVEMBER 27-28 2013 SharePoint 2013 APIs demystified JOŠKO IVANKOV, EVISION
57

SharePoint 2013 APIs demystified

Jan 28, 2015

Download

Technology

This sessions if for everybody that always wanted to know about SharePoint development, but didn’t have anyone to ask, or didn’t have opportunity to try on their own. We’ll show how to start with SharePoint development, what API to use, when to use client API, is server side object model deprecated, how to setup development environment and more tips & tricks which are not usually mentioned.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: SharePoint 2013 APIs demystified

SHAREPOINT AND PROJECT CONFERENCE ADRIATICS 2013

ZAGREB, NOVEMBER 27-28 2013

SharePoint 2013 APIs demystified

JOŠKO IVANKOV, EVISION

Page 2: SharePoint 2013 APIs demystified

sponsors

Page 3: SharePoint 2013 APIs demystified

Agenda• About SharePoint• SharePoint APIs history• SharePoint 2013 API overview• What API to choose• SharePoint Apps overview• SharePoint Dev environment• Key Takeaways• Q&A

Page 4: SharePoint 2013 APIs demystified

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!!!

Page 5: SharePoint 2013 APIs demystified

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

Page 6: SharePoint 2013 APIs demystified

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

Page 7: SharePoint 2013 APIs demystified

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

Page 8: SharePoint 2013 APIs demystified

Development overview

Client Side• Client Object

Model• REST

Services

Data Platform• Farm• Sites• List data• External lists

Server side• Server Side

Object Model

Page 9: SharePoint 2013 APIs demystified

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)

Page 10: SharePoint 2013 APIs demystified

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

Page 11: SharePoint 2013 APIs demystified

APIs – SharePoint 2013• Server Side Object Model• RPC Calls (owssrc.dll)• ASMX Web Services

• Client-Side Object Model (extended)• New REST APIs

Page 12: SharePoint 2013 APIs demystified

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

Page 13: SharePoint 2013 APIs demystified

Sever object model - example

Page 14: SharePoint 2013 APIs demystified

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!!!

Page 15: SharePoint 2013 APIs demystified

SharePoint 2013 Remote API Architecture

Page 16: SharePoint 2013 APIs demystified

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

Page 17: SharePoint 2013 APIs demystified

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

Page 18: SharePoint 2013 APIs demystified

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…

Page 19: SharePoint 2013 APIs demystified

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)

Page 20: SharePoint 2013 APIs demystified

Client Object Model Mechanics

Page 21: SharePoint 2013 APIs demystified

Changes to CSOM in SharePoint 2013

Page 22: SharePoint 2013 APIs demystified

CSOM using Managed Code

Page 23: SharePoint 2013 APIs demystified

CSOM using JavaScript

Page 24: SharePoint 2013 APIs demystified

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

Page 25: SharePoint 2013 APIs demystified

REST mechanics

Page 26: SharePoint 2013 APIs demystified

REST URLs in SharePoint 2013

Page 27: SharePoint 2013 APIs demystified

Mapping Objects to Resources

Page 28: SharePoint 2013 APIs demystified

Testing REST Calls Through the Browser

Page 29: SharePoint 2013 APIs demystified

Returning ATOM XML vs. JSON

Page 30: SharePoint 2013 APIs demystified

REST Query from Managed Code

Page 31: SharePoint 2013 APIs demystified

REST Query Using JavaScript & jQuery

Page 32: SharePoint 2013 APIs demystified

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…

Page 33: SharePoint 2013 APIs demystified

What API to use?

Page 34: SharePoint 2013 APIs demystified

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

Page 35: SharePoint 2013 APIs demystified

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

Page 36: SharePoint 2013 APIs demystified

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

Page 37: SharePoint 2013 APIs demystified

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

Page 38: SharePoint 2013 APIs demystified

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

Page 39: SharePoint 2013 APIs demystified

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

Page 40: SharePoint 2013 APIs demystified

If you want to do this• Create a Silverlight application that performs CRUD

operations on SharePoint data

…use these APIs• Silverlight client object model

Page 41: SharePoint 2013 APIs demystified

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

Page 42: SharePoint 2013 APIs demystified

If you want to do this• Create an app for Office that works with SharePoint

…use these APIs• JavaScript client object model

Page 43: SharePoint 2013 APIs demystified

If you want to do this• Create a custom Windows PowerShell command

…use these APIs• Server object model

Page 44: SharePoint 2013 APIs demystified

If you want to do this• Create a timer job

…use these APIs• Server object model

Page 45: SharePoint 2013 APIs demystified

If you want to do this• Create a custom Web Part, application page, or ASP.NET

user control

…use these APIs• Server object model

Page 46: SharePoint 2013 APIs demystified

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

Page 47: SharePoint 2013 APIs demystified

What to chose?

SharePoint Server Side Object Model

PowerShell Client Object Model REST API

Admin stuff

Communicate with SharePoint from outer world

Page 48: SharePoint 2013 APIs demystified

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 *

Page 49: SharePoint 2013 APIs demystified

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

Page 50: SharePoint 2013 APIs demystified

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

Page 51: SharePoint 2013 APIs demystified

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!

Page 52: SharePoint 2013 APIs demystified

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

Page 53: SharePoint 2013 APIs demystified

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

Page 54: SharePoint 2013 APIs demystified

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

Page 55: SharePoint 2013 APIs demystified

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

Page 56: SharePoint 2013 APIs demystified

questions?

[email protected]

@JOSKOI

Page 57: SharePoint 2013 APIs demystified

thank you.

SHAREPOINT AND PROJECT CONFERENCE ADRIATICS 2013

ZAGREB, NOVEMBER 27-28 2013