sharepoint 2013 and legacy web apps

39

Click here to load reader

Upload: dea

Post on 25-Feb-2016

99 views

Category:

Documents


9 download

DESCRIPTION

SharePoint 2013 and legacy web apps. How to use the Provider-Hosted App Model to make them available in SharePoint 2013 Office 365 Sites. Hi Everyone!. Name: Paul Aldigé Katz Email: [email protected] Twitter Handle: @ napkatz Company: LimeLeap ( http://www.limeleap.com ) - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: SharePoint 2013 and legacy web apps

SharePoint 2013 and legacy web apps

How to use the Provider-Hosted App Model to make them available in SharePoint 2013 Office 365 Sites

Page 2: SharePoint 2013 and legacy web apps

Hi Everyone! Name: Paul Aldigé Katz

Email: [email protected]

Twitter Handle: @napkatz

Company: LimeLeap (http://www.limeleap.com)

LinkedIn: https://www.linkedin.com/profile/view?id=2708087

Job Title: Chief Software Architect

Hobbies: Tennis, Windows Phone Development (in my copious amount of free time)

Page 3: SharePoint 2013 and legacy web apps

And I’m a new dad! Eli gave me the day off

Page 4: SharePoint 2013 and legacy web apps

SharePoint’s New App Model

To highlight the new app model briefly, Microsoft has:

Completely separated custom server-side code from SharePoint in order to protect SharePoint’s core code from extra resource intensive processing. Unlike web parts, no server-side app code runs on SharePoint’s server.

In return, Microsoft has made a HUGE investment in providing service-based methods for exposing SharePoint’s object library to code running on other servers.

Page 5: SharePoint 2013 and legacy web apps

SharePoint’s New App Model

From a GUI perspective, apps appear: Within iFrames inside of SharePoint pages using App Parts OR As full web sites running on a different server using SharePoint’s available client-side

libraries and web services to bring in SharePoint’s design theme.

In either case, your app’s server-side code does not run in SharePoint

Your app’s server-side code can either run in an auto-hosted Azure space, or on your own server infrastructure, via the provider-hosted app model.

For the purposes of this presentation, we’ll focus on the latter

Page 6: SharePoint 2013 and legacy web apps

Why choose the Provider-Hosted hosting method? Your app might need to run behind a corporate firewall; for whatever

reason, hosting it in the cloud is a no-no.

Your app’s server-side code is PHP, JSP, etc…

SharePoint 2013 is just one of many clients for your web application

You just like the control of directly running your own app

Page 7: SharePoint 2013 and legacy web apps

I’ll show you how we turned this:

Page 8: SharePoint 2013 and legacy web apps

Into that:

Page 9: SharePoint 2013 and legacy web apps

Assumptions for this presentation

You have a SharePoint 2013 Office 365 Developer Site: Free 30 Day Trial Available, $100 a year afterward

http://msdn.microsoft.com/en-us/library/fp179924.aspx Free for MSDN Premium and Ultimate Subscribers Can be provisioned from Office 365 E1 or E3 plans

You have Visual Studio 2012 Professional or higher installed, and Microsoft Office Developer Tools for Visual Studio 2012

You have at least Visual Studio 2010 or higher to upgrade the codebase of your existing web application

Page 10: SharePoint 2013 and legacy web apps

Assumptions for this presentation

Your existing web application: is at least a .NET 4.0 web application

Uses some form of internal users database table to manage accounts We’ll be syncing this later with the Office 365 account

Page 11: SharePoint 2013 and legacy web apps

SharePoint Site SetupSome initial setup steps to do on your SharePoint site

Page 12: SharePoint 2013 and legacy web apps

Create an App Catalog Site Click Admin on the top menu and then

click SharePoint in the dropdown

Click apps on the right sidebar

Click App Catalog under apps. SharePoint will guide you though creating your App Catalog Site if you don’t already have one

Page 13: SharePoint 2013 and legacy web apps

Use appregnew.aspx to create a client secret based relationship with your app <Your SharePoint Site>/_layouts/15/appregnew.aspx

Page 14: SharePoint 2013 and legacy web apps

Use appregnew.aspx to create a client secret based relationship with your app

This method does not support multi-tenant uses of your app

Use the Microsoft Seller Dashboard if you want to “sell” your app to multiple SharePoint installations

Your app Domain will need to include a specific port number if it won’t be running on a standard SSL port.

Make sure you write down the information created. It will be necessary when packaging your app.

Page 15: SharePoint 2013 and legacy web apps

Building Your App In Visual Studio 2012How to build your on-premise app

Page 16: SharePoint 2013 and legacy web apps

Create your app in VS2012 - ISpecify your SharePoint 2013 site

Make sure your select “Provider-hosted” for where you want to host your app.

Page 17: SharePoint 2013 and legacy web apps

Create your app in VS2012- IISpecify Use client secret when setting up authentication

Page 18: SharePoint 2013 and legacy web apps

Create your app in VS2012- III

Your new solution contains two projects:

The SharePoint 2013 App project

A matching web application project that Visual Studio assumes will be your provider hosted app. For the purposes of this walkthrough you can ignore it.

Page 19: SharePoint 2013 and legacy web apps

In your appManifest.xml file, specify the start page of your app

Page 20: SharePoint 2013 and legacy web apps

Then update the code of your AppManifest.xml file to include your client ID.

Page 21: SharePoint 2013 and legacy web apps

Add an app part to embed an interface inside a SharePoint page

Page 22: SharePoint 2013 and legacy web apps

Now Publish your app to create an .app file.

You’ll be asked for your Client ID and Secret. Enter them in the wizard.

Also, specify the website your app will be hosted

it’s OK to specify an SSL address that doesn’t exist. For our method of deployment, it doesn’t matter

Page 23: SharePoint 2013 and legacy web apps

Publish your app to SharePointMake it available for your site collections

Page 24: SharePoint 2013 and legacy web apps

Upload your app file to the SharePoint developer site. Go to your App Catalog Site, and click the Distribute apps for

SharePoint tile

Page 25: SharePoint 2013 and legacy web apps

Upload your app file

Click new app, and upload the .app file the Visual Studio publishing tool created.

After the upload, add any additional information for your catalog entry:

Page 26: SharePoint 2013 and legacy web apps

We’re half done!!!Now we need to make your web application talk to SharePoint

Page 27: SharePoint 2013 and legacy web apps

Web Application UpdatesUpdates you can make

Page 28: SharePoint 2013 and legacy web apps

Install the SharePoint Server 2013 Client Components SDK http://www.microsoft.com/en-us/download/details.aspx?id=35585

Install it on the web server that will be hosting your provider-hosted app

Also, install it on any development workstations that do not have Visual Studio 2012 installed, but will be used to update the web application’s code.

Page 29: SharePoint 2013 and legacy web apps

Also install Microsoft Identity Foundation http://www.microsoft.com/en-us/download/details.aspx?id=17331

Page 30: SharePoint 2013 and legacy web apps

In your Visual Studio web project, add.. TokenHelper.vb or TokenHelper.cs

Can be cut and pasted from the Visual Studio 2012 app project. Should also be available online

Also add the following references Microsoft.IdentityModel – Set Copy Local to true Microsoft.IdentityModel.Extensions – Set Copy Local to true Microsoft.SharePoint.Client – Set Copy Local to true Microsoft.SharePoint.Client.Runtime – Set Copy Local to true System.IdentityModel System.Web.Extensions System.ServiceModel System.Web.Extensions

Page 31: SharePoint 2013 and legacy web apps

Add your ClientId and ClientSecret to the web.config file of your application

The default TokenHelper code reads these Now that both your SharePoint App and your Web Application have

them, there is a basis for them to trust each other!

Page 32: SharePoint 2013 and legacy web apps

On the start page of your app, determine the user’s identity

Leverage this against your user’s table to determine the user accessing your site

Page 33: SharePoint 2013 and legacy web apps

Feel free to alter TokenHelper…

For one of our apps, we made a version that can be instantiated, with the client settings then loaded in from a database.

This approach allowed for multiple SharePoint apps to work off the same web application.

Update reference code is attached to this slide.

TokenHelper.vb

Page 34: SharePoint 2013 and legacy web apps

You should now have a fully authenticated SharePoint 2013 app!Although, it looks nothing like SharePoint probably…

Page 35: SharePoint 2013 and legacy web apps

Use the Chrome ControlBring a bit of SharePoint 2013 into your apphttp://msdn.microsoft.com/en-us/library/fp179916.aspx

Page 36: SharePoint 2013 and legacy web apps

The Chrome Control

Essentially, the Chrome Control uses JavaScript to: load in the style sheet from your SharePoint site Integrate a top navigation bar you can customize.

For more info: http://msdn.microsoft.com/en-us/library/fp179916.aspx

Page 37: SharePoint 2013 and legacy web apps

Update your web application’s GUI Code Minimize how your application’s style sheet interferes with SharePoint’s style sheet.

Use my ThemeHelper class to bring SharePoint colors into your style sheets http://

go.limeleap.com/community/bid/287707/How-to-Easily-Bring-SharePoint-2013-Theme-Colors-Into-Your-Apps

This is a HUGE timesaver if it can be assumed your App will have Manage rights for the SharePoint site

If Your Have More Time…. Adopt SharePoint styles instead of using your web application’s styles so that your

application’s design changes properly when an end-user changes their SharePoint theme.See if the overall layout of your web application fits SharePoint’s Modern UI look and feel.

Page 38: SharePoint 2013 and legacy web apps

Let’s dive into some code!A look at how Authentication is working, the Chrome Control, and ThemeHelper!

Page 39: SharePoint 2013 and legacy web apps

Summary

It doesn’t take long to get a legacy .NET application connected to a SharePoint 2013 Office 365 site, complete with seamless authentication

You can enjoy the relative inexpensiveness and availability of a SharePoint 2013 Office 365 site, while pulling in legacy applications hosted elsewhere The price for each Office 365 E1 user is only $8.00 a month, and also includes

Hosted Email, Office Web Apps, Lync, Skydrive Pro

We really haven’t touched the surface of what SharePoint apps can actually do with the SharePoint object model. All we did was authenticate, but there’s tons more available via the SharePoint.Client library