Upload
kory-ball
View
266
Download
3
Embed Size (px)
Citation preview
SharePoint Web Templates On-premise and in the CloudMirjam van OlstSharePoint Architect @ Avanade
SPC220
http://sharepointchick.com
@mirjamvanolst
http://www.diwug.nl/e-magazines
About Mirjam
Web Template Fundamentals Creating Web Templates
Using Web Templates
Agenda
Web Templates and App Webs
Wrap Up
Web Template Fundamentals
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
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
• 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
• Build using an elements.xml file and an ONET.xml• No webtemp.xml file!
Web Templates basics
• 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
Creates a sandboxed solution
Save Site as Template
Stored in site collection solution gallery
Can be imported into Visual Studio
“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
• A site created using a Web Template only knows about the “base” site definition• SPWeb.WebTemplate = STS• SPWeb.WebTemplateId = 1
Web Templates
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
• 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
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
Creating Web Templates
Web Template element
• 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
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
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
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
Using Web Templates
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
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
Can be used from code
Using Web Templates
Apply with[web template feature GUID]#[web template name]
Demo
Building Web Templates
Web Templates and App Webs
• Apps for SharePoint are like Apps for Phones• They are user driven• They have to be self-contained
Mindset
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
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
Either create the App Web using site definition App#0(default)
App Webs
Or create the App Web using a custom web template
• 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
AppManifest.xml code
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
SharePoint Web Templates On-premise and in the CloudMirjam van OlstSharePoint Architect @ Avanade
QUESTIONS?
Evaluate this session now on MySPC using your laptop or mobile device: http://myspc.sharepointconference.com
MySPC
© 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.