39

SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Embed Size (px)

Citation preview

Page 1: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up
Page 2: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

SharePoint Web Templates On-premise and in the CloudMirjam van OlstSharePoint Architect @ Avanade

SPC220

Page 3: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

http://sharepointchick.com

@mirjamvanolst

[email protected]

http://www.diwug.nl/e-magazines

About Mirjam

Page 4: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Web Template Fundamentals Creating Web Templates

Using Web Templates

Agenda

Web Templates and App Webs

Wrap Up

Page 5: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Web Template Fundamentals

Page 6: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Creating SitesPast, present & future

<= SharePoint 2007 >= SharePoint 2010

Site Definitions

– Deployed to the SharePoint Server

– ONET.xml in [SharePointRoot]\Template\SiteTemplates folder

– WebTemp.xml in [SharePointRoot]\TEMPLATE\1033\XML folder

– Can’t be changed after sites have been created based on it

Site Templates– “Save Site as Template” creates .stp files

Page 7: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Creating SitesPast, present & future

<= SharePoint 2007 >= SharePoint 2010

Web Templates– Deployed to the SharePoint Server or Solutions Gallery

– Can be changed after sites have been created based on it

Site Templates– “Save Site as Template” creates .wsp files

– Uses Web Template improvements

Page 8: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

• Created using WebTemplate Feature

element

• Can be Site and Farm scoped• Site scoped:

• Web Template will only be available in a site collection where the feature is

activated

• Farm scoped:

• Web Template will be available in the entire farm

• Web Template can be used to create site collections from Central Administration

Web Templates basics

Page 9: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

• Build using an elements.xml file and an ONET.xml• No webtemp.xml file!

Web Templates basics

Page 10: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

• Can be created in two ways:• Use “Save Site as Template” on site settings page (site

templates)

• Use Visual Studio (web templates)

• Both types create a .wsp file

• Both look the same when creating a site

Web Templates

Page 11: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Creates a sandboxed solution

Save Site as Template

Stored in site collection solution gallery

Can be imported into Visual Studio

Page 12: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

“Based” on a site definition

Web Templates

Do NOT inherit from their “base” site definition

Can be changed or deleted after they have been used

Page 13: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

• A site created using a Web Template only knows about the “base” site definition• SPWeb.WebTemplate = STS• SPWeb.WebTemplateId = 1

Web Templates

Page 14: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Web Templates created in Visual Studio

Publishing Features

Saving sites as templates

Can be based on publishing sites and can use the publishing feature

That have the publishing feature activated is not supported

Page 15: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

• Module element• Use features to provision your (default.aspx) pages

• Components• FileDialogPostProcessor –class used to modify the file open and save

dialog’s interfaces on a document library• ExternalSecurityProvider –interface that returns custom information

about the security used in Microsoft SharePoint Foundation for indexing by a search crawler on a portal

• ServerEmailFooter• Feature Stapling• Variations Hierarchy

Web Template limitations

Page 16: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Web Template ProvisioningCreate URL for the site

Provision GLOBAL onet.xml

Site collection: Activate site collection scoped features in defined orderSub site: Verify that site collection scoped features are activated

Activate site scoped features from onet.xml in defined order

Create list instances from onet.xml

Page 17: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Creating Web Templates

Page 18: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Web Template element

Page 19: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

• Required properties of WebTemplate feature

element:• BaseTemplateName - STS (or any other site definition template name)

• BaseTemplateID - 1 (or any other site definition template ID)

• BaseConfigurationID - 0

Web Template basics

Page 20: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Copy ONET.xml from an out of the box site definition and strip it

Web Template ONET.xml

ONET.xml file can only contain one configuration

Configuration needs to have ID=0

Page 21: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

More features will make the site creation slower

Web Templates best practicesUse “enough” features

Not enough features makes upgrading very challenging

Be careful with Site scoped features – can block sub site creation

Page 22: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Create a hidden web scoped feature

Web Templates best practicesStore Web Template information

Add it to the WebFeatures section of the onet.xml file

Store the Web Template name, feature ID and version in site property bag

Page 23: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Using Web Templates

Page 24: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Farm Solution

Web Templates deployment

Sandboxed Solution

Farm or Site scoped feature

ONET.xml file is stored in the feature folder with elements.xml file

Site scoped feature

ONET.xml file and elements.xml file are stored in the content database

Page 25: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Web Templates that are built as sandboxed solutions can be deployed to Office 365

Web Templates in Sandboxed Solutions

Sandboxed solutions are deprecated, but still fully functional in SharePoint 2013

Make sure the sandboxed solution can be removed after creating the site

Page 26: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Can be used from code

Using Web Templates

Apply with[web template feature GUID]#[web template name]

Page 27: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Demo

Building Web Templates

Page 28: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Web Templates and App Webs

Page 29: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

• Apps for SharePoint are like Apps for Phones• They are user driven• They have to be self-contained

Mindset

Page 30: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

You cannot deploy web templates to create other sites within an App

Deploy web templates in an App

You can only deploy a web template to create the App Web with

Page 31: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

App Webs

Browse

http://teamsite.wingtip.com/sites/apptest/_layouts/15/start.aspx#/SitePages/Home.aspx

Host Web

http://app-fef8493a3feb20.wingtipapps.com/sites/apps/BambooWeather/Pages/Home.aspx

App Web

Add App

Page 32: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Either create the App Web using site definition App#0(default)

App Webs

Or create the App Web using a custom web template

Page 33: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

• Deployed in the App itself• In a web scoped feature• Using an ONET.xml and an elements.xml

• Defined in the appmanifest.xml• Using the WebTemplate element • ID=[{GUID of the App Web feature}]#[Web Template “Name”

attribute]• “FeatureId” property is obsolete

• You cannot use out of the box site definitions

A custom App Web web template

Page 34: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

AppManifest.xml code

Page 35: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Wrap Up

Page 36: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Use web templates to create templated sites

No templated sites in Apps – use full trust or sandboxed solutions

Build with deprecation of sandboxed solutions in mind

Plan feature scope and amount

Wrap Up

Page 37: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

SharePoint Web Templates On-premise and in the CloudMirjam van OlstSharePoint Architect @ Avanade

QUESTIONS?

Page 38: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

Evaluate this session now on MySPC using your laptop or mobile device: http://myspc.sharepointconference.com

MySPC

Page 39: SPC220 Web Template FundamentalsCreating Web Templates Using Web Templates Web Templates and App Webs Wrap Up

© 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.