21
#CampusDays SharePoint App Architecture for the Cloud and on-premise Prod3003 Sonja Madsen SharePoint MVP

Share point app architecture for the cloud and on premise

Embed Size (px)

Citation preview

#CampusDays

SharePoint App Architecture for the Cloud and on-premiseProd3003

Sonja Madsen

SharePoint MVP

#C

am

pusD

ays

Sonja Madsen

• SharePoint MVP

• Owner of Sonjasapps

• Blog at sp2013.blogspot.com, tweet at @sonjamadsen

• Consulting

• Microsoft partner and vendor

• Speaker at conferences on SharePoint topics

• Over 10 years with SharePoint

• Self-employed

• Creuna, Proactive, DIS-Play, Avanade, Microsoft

#C

am

pusD

ays

Agenda

• Provider apps

• Demo - Create team sites on Office 365

• Office App Model Samples Team

• Farm code -> Client Object Model

• Demo – Create sites with metadata

• How it works

• JavaScript vs C#

#C

am

pusD

ays

Provider apps

SharePoint 2013

Office 365

Provider app

Cloud

On-premise

#C

am

pusD

ays

Projects Web

Demo: create team project sites on Office 365

#C

am

pusD

ays

SharePoint out-of-box

No project metadata, no overview

No governance on how to call sites, where to create sites, permissions

How to find ”my project sites"

Look and feel, site templates?

#C

am

pusD

ays

SharePoint Hosted vs Provider App

Client Object Model

Elevate permissions with Provider App

JavaScript vs C#

Hosting

Developer environment

#C

am

pusD

ays

Demo

#C

am

pusD

ays

Architecture

Provider app code List

Sites

Overview

Hosting, Visibility, Maintenance, Administration, UI, End-User Involvement

#C

am

pusD

ays

User Voice

Office App Model Samples team

https://github.com/OfficeDev/PnP/tree/dev

http://blogs.office.com/2014/08/13/uservoice-driving-improvements-sharepoint-api/

#C

am

pusD

ays

Farm Solution Provider Appusing (SPSite site = new SPSite(projectweburl))

{

using (SPWeb web = site.RootWeb)

{

web.AllowUnsafeUpdates = true;

int TemplateI = 0;

string lcid = System.Threading.Thread.CurrentThread.CurrentUICulture.LCID.ToString();

SPWebTemplateCollection webTemplates = site.GetWebTemplates(Convert.ToUInt32(lcid));

for (int i = 0; i < webTemplates.Count; i++)

{

if (webTemplates[i].Title == sitetemplatetitle)

{

TemplateI = i;

}

}

SPWebTemplate webTemplate = webTemplates[TemplateI];

string webTitle = title;

string webUrl = id;

//create project site

web.Webs.Add(webUrl, webTitle, "",

uint.Parse(lcid), webTemplate, false, false);web.Update();

}

}

var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);

using (var clientContext = spContext.CreateUserClientContextForSPHost())

{

if (clientContext != null)

{

WebCreationInformation creation = new WebCreationInformation();creation.Url = webTitle;

creation.Title = webTitle;

Web newWeb = clientContext.Web.Webs.Add(creation);

clientContext.Load(newWeb);

clientContext.ExecuteQuery();

}

}

#C

am

pusD

ays

Farm Solution Provider App

ThmxTheme.SetThemeUrlForWeb(currentweb, currentweb.ServerRelativeUrl

+ "/_catalogs/theme/SK.thmx");

currentweb.Update();

siteWeb.ApplyTheme(colorPaletteFile.ServerRelativeUrl, fontSchemeFile.ServerRelativeUrl,null, true);

siteWeb.Update();

clientContext.ExecuteQuery();

#C

am

pusD

ays

C# JavaScript

var context = SP.ClientContext.get_current();

SP.Utilities.Utility.logCustomAppError(context, "My custom error message.");

context.executeQueryAsync(function(){},function(){});

#C

am

pusD

ays

Demo

#C

am

pusD

ays

Demo

#C

am

pusD

ays

JavaScript vs C#

Client Object Model

Elevate permissions with Provider App

JavaScript vs C#

No Web Parts with C#

Can’t remove Web Parts from page with C#

Custom forms – JavaScript

Intellisense

#C

am

pusD

ays

Summary

• Provider apps

• Demo: create team sites on Office 365

• Demo - Office App Model Samples Team

• Farm code -> Client Object Model

• Demo – create sites with metadata

• How it works

• JavaScript vs C#

#C

am

pusD

ays

SharePoint App Architecture for the Cloud and on-premiseProd3003

EVENT SPONSORER

EXPO SPONSORER

TRACK SPONSORER

#C

am

pusD

ays

Q&A#Ask me about everything!

Join me at the Microsoft Booth the next 30 minutes @Meet The Experts

Dont forget to: Evaluate this session!