Getting to grips with SharePoint 2013 “apps”Chris O’Brien SharePoint MVPwww.sharepointnutsandbolts.com
Independent SharePoint consultant
Blog: www.sharepointnutsandbolts.com
Twitter: @ChrisO_Brien
LinkedIn: http://uk.linkedin.com/in/chrisobrienmvp
About me
What is an app?
Adds some specific functionality to a siteE.g. expense reporting, time-tracking etc.
Apps should be safeA bug/performance issue cannot affect the overall stability of SharePointThe ‘engine’ may be in the cloud or on a non-SP server
Apps can be obtained from the app store (“SharePoint Store”)
Customising SharePoint – official guidanceMicrosoft:
The most important guidance we can give you is to develop an app for SharePoint rather than a classic solution whenever you can.
http://msdn.microsoft.com/en-us/library/jj163114(office.15).aspx
Why apps?
End-user familiarityPhones, Windows 8 etc.
Game-changer for Office 365No more sandbox restrictions
Reduce upgrade blockers..which would otherwise delay license revenue
3 decisions to make on apps
Are we going to allow apps?Create infrastructure, obtain wildcard SSL certificate etc.
Are we going to allow ANY app from the SharePoint Store to be installed?
Or are we going to restrict to certain ‘approved’ apps via the internal App Catalog?
Will our own customisations be developed as apps?
App dev fundamentals
No server-side SharePoint code
Usually no provisioning to “host” siteLists, content types etc. get provisioned to the “app web”
Deep changes to a site not possibleE.g. branding, site templates, themes etc.
Timer jobs, custom field types not possibleBUT, their end result can be achieved
App hosting options
SharePoint-hostedJavaScript only
Cloud appProvider-hosted (YOU deal with hosting)
IIS, PHP/LAMP, something else!
Auto-hosted (O365 + Azure)E.g. automatically create database in SQL Azure
Hybrid app = combination
Apps and SSL
Microsoft:
Secure Sockets Layer (SSL) is a requirement for web applications that are deployed in scenarios that support server-to-server authentication and app authentication.
http://technet.microsoft.com/en-us/library/ee806885(v=office.15).aspx So do it in dev
too!
How users obtain apps
User-driven:Public store (if enabled)Internal app catalog – admin-approved apps
Administrator-driven:Installed to selected sites via PowerShell“Tenant-install” – one shared instance (not instance per site)
demo
Obtaining apps –Store and App Catalog
Developing SharePoint-hosted apps
Key characteristics
Even though hosted on SP, app area is on an “isolated” domain (IIS web application)
URL = https://cob-387fbe6473fd9e.spapps.dev/MyAppApp prefix (configurable)ID (generated on each install/upgrade)App domain (should be a distinct domain)App name
Effectively an IIS trick – content is in same site collection!Provides some security against XSS + allows identification of app requests
App architecture
Ingredients of a nice 2013 “learning” app
Creates and uses some content types/lists/files in app web
Fetches some data from host web (cross-domain library)
Uses CSOM/REST
Provisions an app part for UX within host web
Permission requests(s) for host web
(SharePoint-hosted)
demo
Custom SharePoint-hosted apps
SP-hosted app with:
Fields/content typesLists/lookupsJSOM codeSearch (via REST)
Demo screenshots
Developing cloud apps
Definitions
Auto-hosted = Office 365 (SharePoint) + Azure (app)
Azure bit is a bundled/free Azure tenancy – not any existing tenancyCapacity TBA – announcements in 2013Unclear if option to use existing tenancy e.g. for large apps
Provider-hosted = you provide everythingSupport for debugging – runs on http://localhost during devFull flexibility, but more work
Authentication in cloud apps
Auto-hosted (O365 + Azure):EASY – handled for you with ACS/OAuth!
Provider-hosted:HARDER – no OAuth; needs manual “high-trust”/”S2S” config Certificate trust, Register-SPAppPrincipalCode against provided TokenHelper class (extensible)
(the quick story)
Possible reasons for cloud app
Need to go beyond JavaScript to develop functionalityE.g. service layer E.g. use of back-end non-SharePoint data
Needs Remote Event Receivers (app installed, app upgraded etc.)
Needs scheduled process
Needs distinct/complex branding
You don’t want to develop entire app in JavaScriptOR, you want to leverage .Net/PHP/whatever skills
(i.e. something more than SP-hosted app)
demo
Custom cloud apps
Auto-hosted app with:
Chrome ControlWCF serviceUser controls Etc.
Demo screenshots
5 lessons learnt
1. The host site’s URL is only accessible on 1st page load (bug)
Workaround: store in cookie/similar (see my blog)
2. JavaScript runtime error: 'Type' is undefinedJavaScript dependency issue – MicrosoftAjax.js needs to be earlier!
3. Page cannot be displayed in app partAllow Framing tag is missing from page
Troubleshooting apps
5 lessons learnt (ctd)
4. JavaScript errors in a cloud appYou may be trying to use the JavaScript Client Object Model (JSOM) “off-box” from SharePoint – you should use REST, or .NET CSOM
5. Error occurred in deployment step 'Install app for SharePoint': Sideloading of apps is not enabled on this site
You tried to “F5 deploy” to a site not based on Developer Site template – only supported against a Developer Site
Troubleshooting apps
Closing thoughts
The Store could be a great thing for SharePoint
Learning curve for custom app development
User experience considerations:Separation of app from host webAccessing app from Site Contents page
What benefits is the app framework providing?
Blog: www.sharepointnutsandbolts.com
Twitter: @ChrisO_Brien
LinkedIn: http://uk.linkedin.com/in/chrisobrienmvp
Thank you!
Want to read more or contact me?
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to
be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS
PRESENTATION.