Future-Proof Your SharePoint Customizations Build 2010 Solutions that become 2013 Apps @Bob1German
Jun 21, 2015
Future-Proof Your SharePoint CustomizationsBuild 2010 Solutions that become 2013 Apps
@Bob1German
About the Speaker
Bob GermanPrincipal Architect at BlueMetal Architects
Developer and architect on the SharePoint platform since it was called “Site Server 3.0”
Co-author of SharePoint 2010 Development with Silverlight for Addison-Wesley
http://blogs.msdn.com/BobGerman
BlueMetal Architects We are experts at building solutions that exactly meet
the needs of our customers by apply the right people, processes and platforms.
Our focus is on modernizing applications through expertise in Creative, Social, Development and Data.
We have offices in Boston, New York, and Chicago.
@Bob1German
#spfestchi @Bob1German
Who Moved the Cheese?
Traditional SharePoint Development
NewApp
Model
Old PackagingNew Approach
SharePointDeveloper
@Bob1German
A Brief History of SharePoint Development
2007 • Well documented model with “Features” and “Solutions”
2010 • Added Sandbox• Added Client APIs
2013 • Deprecated Sandbox• Added App Model, more Client APIs
Key concept:Microsoft wants us to start developing outside of SharePoint• Similar to Facebook and other online service “apps”• Code runs in browser or an external web site;
access SharePoint via Client API’s• Works in Office 365 and other hosted services• Helps with stability, upgradability on-premises as
well
2003 • First .NET version; limited API• No documented deployment model
20032001 • ASP Classic “Digital Dashboard”• CAML is born
approaches to SharePoint development:
2007 • Well documented model with “Features” and “Solutions”
2010 • Added Sandbox• Added Client APIs
2013 • Deprecated Sandbox• Added App Model, more Client APIs
2003 • First .NET version; limited API• No documented deployment model
20032001 • ASP Classic “Digital Dashboard”• CAML is born
A Brief History of SharePoint Development
Farm Solution Sandboxed App
Hosting: On-prem On-prem, O365
On-prem, O365
Code runs: In browser orOn SharePoint servers
In browser orIn SP user code service process
In browser orOn external site, out of SharePoint
Capability: Unlimited Very Limited Emerging
API: Server Server (limited)
Client
Security: Code can be omnipotent
Code runs as a user
Code runs as app or user
1 2 3@Bob1German
Welcome to the App Model
HostWeb
App Web
SharePointHosted App
Provider or Auto-Hosted App
App Azureor other provider
HostWeb
App Web(optional)
App is installed
here
App runs here
@Bob1German
App Isolation
App Azureor other provider
HostWeb
App Web(optional)
http://myserver/sites/myweb/
http://app12345/sites/myweb/
http://whatevs.com/somepath/
Different domain names leverage browsers’ same-origin policy
@Bob1German
App
HostWeb
AppWeb
Mix and match App Web and Cloud
Provisioned by SharePoint on app installation
Code in Javascript on browserNo Server Code – period!(though you can leverage installed ASP.NET controls)
May contain declarative, web-scoped features (lists, site pages, client script, images, css)
Access host web via cross-domain library
Auto-hosted apps are provisioned by Office 365 on app installation(Office 365 only; not yet released)
Any hosted web site can work; pretty much anything goes
Access host and app webs via OAuth – run under: End user’s permissions App permissions
App Web Provider or Autohosted @Bob1German
The App Model Today
Complete isolation Apps can’t interfere with the
operating system Apps can’t interfere with other apps Apps have granular permissions –
no more omnipotent code
Central distribution Vet and control apps
No more messes The system can clean remove an
app completely App isolation should make upgrades
easier
Applications are restricted Can’t take advantage of server APIs More difficult to interact with other
apps Can’t elevate privileges –
no more omnipotent code
Central distribution Need to configure, host apps
Version 1 Challenges No auto-hosted apps on prem or in
Store Limited functionality
Can’t change host web page (e.g. branding)
Client API’s much better but not complete
Can’t be provisioned in site templates
Most solutions need to be rewritten
The Good The Bad and The Ugly
?Will Sandboxed solutions
really go away, and when?
Where are we supposed to host provider-hosted apps?
Will Auto-hosted apps be available on premises?
And if they are – will they run on premises or in Windows Azure?
Will the app modelbe another flash in the
pan like Sandboxed Solutions or Silverlight?
Will Microsoft stop supporting Farm Solutions
some day?
Will my organization wantto run SharePoint in
the cloud?
What’s a SharePointProfessional to do?
Is my organization ready for SharePoint 2013?
@Bob1German
Develop Outsidethe Box
Instead of… Start to…
Running code on the server
Run code in the browser
Using the Server API Use the Client APIDesigning solutions the traditional way
Design solutions that are structured like apps
Buying products that work only on premises
Buy products that work in Office 365O365?
Pretend you might be going to Office 365…• It’s a good bet Microsoft will invest in development
approaches that work on Office 365• You will enjoy the stability and ease of
administration that Office 365 requires
@Bob1German
The Challenge
Develop useful solutions which
run in SharePoint 2010 andcan be ported to SharePoint
2013 apps with 80% common code*.
* Not including packaging or reusable glue code; explanatory or gratuitous comments excepted; void where prohibited; subject to local challenge terms and restrictions; code is furnished for instructional purposes only and may not be production ready; samples are designed to clearly illustrate technical concepts and not necessarily for reliability or maintainability
@Bob1German
Demo 1:Site Provisioning Tool
Site Provisioning Tool
Lists and provisions child sites using a customWeb Template
Common uses: Manage sites within a department site collection Manage project sites Automatic navigation to child sites
Began its life humbly as a sandboxed solutionNow living a dual life:
In a Content Editor Web Part in SharePoint 2010 In an App in SharePoint 2013
@Bob1German
Site Provisioning Tool
For a detailed description and pointers to the code see:http://blogs.msdn.com/b/bobgerman/archive/2013/10/05/future-proof-solutions-part-1-take-a-walk-on-the-client-side.aspx
@Bob1German
Code Walk-through
2010 2013
1HTML and CSS
1
1
2Get SP Context
2
24
Find WebTemplate
5Create Child Site
3Get and display sites
3, 4, 5
3, 4, 5
Shared Code Analysis
2010 2013
2Get SP Context
3Get and display sites
4Find WebTemplate
5Create Child Site
1HTML and CSS40
25
59
42
33
LINES
LINES
LINES
LINES
LINES
25 not shared174 shared
87%shared
40
42
59
42
33
LINES
LINES
LINES
LINES
LINES
81%shared
42 not shared174 shared
@Bob1German
Demo 2:IT Issues Dashboard
IT Issues Dashboard
Visual tracking of issues across a large department Common uses:
Track service requests (help desk, etc.) Track workflow performance (used with an audit list) Dashboard to display SharePoint list data
The challenge:
The solution: Run it all in a Content Editor Web Part(or in a SharePoint Hosted App)
@Bob1German
Code Walk-through
2010 2013
1HTML and CSS
11
2Get SP Context
2
2
4Compile List Data
5Bind to Charts
3Read List Data
3, 4, 5
3, 4, 5
Shared Code Analysis
2010 2013
2Get SP Context
3Read List Data
4Compile List Data
5Bind to Charts
1HTML and CSS64
25
65
221
33
LINES
LINES
LINES
LINES
LINES
25 not shared383 shared
93%shared
64
42
65
221
33
LINES
LINES
LINES
LINES
LINES
90%shared
42 not shared383 shared
Demo 3:Location Mapping Tool
Location Mapping Tool
Geocodes list items and displays them on a map
Common uses: Display store or customer locations Adapt to plot events or photos on a map Get ready for the new GeoLocation features in SharePoint
2013
This one started as a SharePoint Provider Hosted App
Now moonlighting: As a server-side event handler and
Visual Web Part in SharePoint 2010 As a remote event handler and Client Web Part
in a SharePoint Provider Hosted App
@Bob1German
Code Walk-through2010 2013
4
4
4Handle List Event
2Locations List
2
2
3HTML and CSS
3 3
5Geocode; Update list
5
5
6Get SP Context
6
6
7Display Map
7
7
1GeoLocation Field
1
1
Shared Code Analysis
2Locations List
5Geocode; Update list
6Get SP Context
7Display Map
1GeoLocation Field
3HTML and CSS
4Handle List Event
2013
45
156
20
63
286
LINES
LINES
LINES
LINES
LINES
83%shared
121 not shared585 shared
13LINES
123LINES
2010
39
156
20
49
286
LINES
LINES
LINES
LINES
LINES
99 not shared585 shared
86%shared
11 LINES
123 LINES
Summary and Call to Action
Prepare for the future:Pretend you might be going to Office 365
Update Development Skills Learn client side development (Javascript, jQuery, Client OM, etc.) Learn SharePoint App design patterns Learn Azure and Oauth
Develop more in the browser, less on the serverFavor client APIs over server APIs
Demo Code and Downloads Now Available
http://blogs.msdn.com/BobGerman
@Bob1German
Thank You!
BOSTON | NEW YORK | CHICAGO
44 Pleasant Street, Watertown, MA 02472
www.bluemetal.comBlog.bluemetal.com
@bluemetalinc