an introduction to the office devpnp community initiative
TRANSCRIPT
An Introduction to the OfficeDevPnP
Community InitiativeNigel Price
Thanks to the Sponsors!
With Thanks, Apologies and Acknowledgements to Vesa
Juvonen, Erwin Van Hunen, Paolo Pialorsi and Bert Jansen
What is Office 365 Developer Patterns and Practices (PnP)• PnP is community driven open source project where Microsoft and
external community members are sharing their learning's around implementation practices for Office 365 and SharePoint on-premises (add-in model). Active development and contributions happen at our GitHub project under Dev branch and each month there is a master merge (monthly release) with more comprehensive testing and communications. Latest activities and future plans are covered in the monthly community calls which are open for anyone from the community. Download invite from http://aka.ms/OfficeDevPnPCall.
Why Do We Need The OfficeDevPnP
Initiative ?
SharePoint evolves…SharePoint 2007
SharePoint 2010 SharePoint
2013
Sandbox
C#
C#C#
Provider Hosted Add-Ins
C#
JSJS
_api
“We’ve heard this story so many times, but want to stay on doing farm solutions at on-premises…”
Absolutely nothing wrong with that. Evaluate your business requirements and chose the right customization model for you.
What does add-ins mean in our terminology
Classic - Full trust solutions• ISV solutions• Platform level customizations to on-premises
• Custom service applications
• Custom WCF services• SharePoint customizations, not customer specific customizations
Client Side Solutions• Server side controls as JavaScript on page layouts and master pages
• Remote provisioning for elements
• Embracing un-ghosted model
• SP add-in dimension with provider hosted apps to provide new capabilities
• Customer specific customizations
Store add-ins• Add-in catalog based solution
• Packaged reusable solutions built for specific functionality
• Not only for market place or store, but also as platform for customer specific customizations
SharePoint Add-Ins means all operations which are executed outside of the server
xml
Content Type B
Manifest xml in the solution package introduces the feature framework elements.
\\15\templates\features\FeatureA
Configuration database
Content database
Content Type A
Content Type C
Feature framework feature with element xml files for content type and site columns.
WSP package1
2
3
Content type and site columns with dependencyNot recommended approach
Provisioned content types And site columns have dependency on element xml files
Same dependency challenge applies for Sandbox solutions…
Modules with Feature Framework These are essentially files
deployed to the site You should follow the same
“remote provisioning pattern” that we outlined for application artifacts such as .webpart files, page layouts and master pages.
Challenge with feature framework based provisioning is that any operation to sandbox or farm solution will impact directly end user sites
Note. This pic is for farm solution based provisioning, but same challenge is with sandbox solutions.
Full trust solution challenges• Full trust solutions with ghosted files– Implications to Disaster Recovery model
• Deployments always cause downtime– Impact on Service Level Agreements as well as availability– Very expensive to maintain enough Infrastructure to reach
“near zero”• Full trust solutions have to be closely analyzed– Do you trust your solution fully?– Complex Application Lifecycle Management processes
• Not available in Office 365 (Multi-Tenant or Dedicated vNext)
What if… We would use
same model for on-premises and
cloud?
Introducing CSOM and The OfficeDevPnP
Initiative
What is CSOM ?• CSOM is short for the Client Side Object Model• It allows another machines to interact with SharePoint servers to
create and operate on Content Types, Site Columns, Lists etc• The other machine can be anything :- Windows, Linux • The code on the other machine can be anything C#, PowerShell, PHP
etc• It covers almost all of the functionality that the Server Side Object
Model does (Information Management Policies is an exception)
So What is OfficeDevPnP ?• OfficeDevPnP was started by Vesa Juvonen, Erwin Van Hunen, Paolo Pialorsi
and Bert Jansen (and apologies to anyone I have missed) 12 – 18 months ago• Vesa and Bert work for Microsoft and Erwin and Paolo work for other
companies• OfficeDevPnP is a framework which has been built on top of CSOM to make
it easier for developers and IT Pros to use CSOM• OfficeDevPnP is a community Initiative which anyone can get involved in and
contribute (ie Its OpenSource)• Works with both SharePoint online and SharePoint On Premises
(SP2013,SP2016)
What Does The OfficeDevPnP Consist Of ?• PnP Sites Core Component - GitHub repository • PnP Core Component (JavaScript) - GitHub repository• PnP PowerShell - GitHub repository• PnP Partner Pack - Reusable starter kit for typical enterprise requirements• PnP Guidance - GitHub repository• PnP Office-Addins - GitHub repository• PnP Tools - GitHub repository• PnP Transformation - GitHub repository• PnP Provisioning Schema - GitHub repository
Remote Provisioning Using OfficeDevPnP
M I C R O S O F T C O N F I D E N T I A L – I N T E R N A L O N LY
Site provisioning is the heart and soul for each enterprise deployment…
Evergreen and release cycle – old model
SP2007 SP2010 SP2013 SP2016
Tightly coupledSharePoint customizations
Upgrade Upgrade Upgrade Upgrade
• Specific upgrade project each time new version is introduced• Customizations have to be upgraded to get access on new capabilities in product• Will cause additional costs during each release cycle of customizations• Customization updates cause downtime each time something is changed• Complex ALM processes for ensuring quality of the code
Evergreen and release cycle – new model
SP2013
Loosly coupledSharePoint customizations
SP2016 O17 O18
Development
• You choose when and how applications are updated • Backwards compatibility for API level to move customizations cross versions• Customizations don’t block new capabilities from SharePoint• Customizations extend, not change SharePoint• Customizations can be updated with minimal impact on SharePoint
Customizations will utilize services from SharePoint and other services, but won’t usually change out of the box services.
xml
Content Type B
Assets and configurations either using just code or with for example xml
Content database
Content Type A
Content Type C
PowerShell or code provisioning the assets using remote provisioning pattern directly to content database.
1
Content types do not have any dependency and farm solution can be retracted without any impact to them
2
Content type and site columns with remote provisioningRecommended approach
Comparison of CSOM and OfficeDevPnP – Creating a ListClientContext context = new ClientContext("http://SiteUrl"); // The SharePoint web at the URL.Web web = context.Web; ListCreationInformation creationInfo = new ListCreationInformation();creationInfo.Title = "My List";creationInfo.TemplateType = (int)ListTemplateType.Announcements;List list = web.Lists.Add(creationInfo);list.Description = "New Description"; list.Update();context.ExecuteQuery();
#SPO Sample $cred = Get-Credential -UserName '[email protected]' -Message "Enter SPO credentials"
#Connect to new site and validate Connect-SPOnline -Url 'https://njpenterprises.sharepoint.com/sites/SPS-London-demosite99' -Credentials $cred -ErrorAction Stop #Create list New-SPOList -Title "Demo list" -Template GenericList -Url 'lists/demo'
Create List using OfficeDevPnP
DemoPnP
Creating Different Types of Fields
Add-SPOField -DisplayName "Project End Date" -InternalName "ProjectEndDate" -Id "65E1E394-B354-4C67-B267-57407C416C10" -Type Date -Required -Group "Tender Group"
Add-SPOTaxonomyField -DisplayName "Record Type" -InternalName "RecordType" -Id "{53FF9B38-32F2-47A0-A094-D3692CB52352}" -Group "Tender Group" -TermSetPath "InnovateUK|Tenders|Record Type“
Add-SPOField -DisplayName "Project Phase" -InternalName "ProjectPhase" -Id "{53FF9B38-32F2-47A0-A094-D3692CB52354}" -Type Choice -Group "Tender Group" -AddToDefaultView -Choices "Initiation","Definition","Development","Delivery","Evaluation"
Add-SPOField -DisplayName "Supplier Name" -InternalName "SupplierName" -Id "65E1E394-B354-4C67-B267-57407C416C15" -Type Text -Required -Group "Tender Group"
Add-SPOField -DisplayName "Project Name" -InternalName "ProjectName" -Id "65E1E394-B354-4C67-B267-57407C416C16" -Type Text -Required -Group "Tender Group"
Create Fields and Content Types using OfficeDevPnP
DemoPnP
OfficeDevPnP Site Provisioning Framework
Business user driven templates
Provisioning engine
Provider Hosted App / PowerShell
SharePoint Service
https://contoso.sharepoint.com/sites/site
1 2
54
3
Extract template
Modify with browser
Template details are being extracted from actual template sites during provisioning.Templates can be modified and created using browser UI and all changes are reflected to the newly created and potentially modified sites.
Template sites
PnP Site Provisioning FrameworkC#
// Get template from existing sitetemplate = ctx.Web.GetProvisioningTemplate();
XMLFileSystemTemplateProvider
XMLAzureStorageTemplateProvider
XMLSharePointTemplateProvider
1
2
4
Site A
Site B
Connectors
3
// Save template using XML providerXMLFileSystemTemplateProvider provider = new XMLFileSystemTemplateProvider(@"c:\temp\", "");string templateName = "template.xml";provider.SaveAs(template, templateName);
// Load the saved model againProvisioningTemplate p2 = provider.GetTemplate(templateName);
// Apply template to existing sitectxTarget.Web.ApplyProvisioningTemplate(template);
PnP Site Provisioning Framework
Demohttps://github.com/OfficeDev/PnP/tree/master/Samples/Provisioning.Framework.Console
PnP
What is the challenge with custom master page?
Time
Oob Master
Custom Master<< Copy >>
Service updates for introducing new version of the out of the box master page with some new capabilities or bug fixes.
Significant differences on the outcome unless custom master page been updated during the releases.
New custom master page is created by copying oob master or starting from scratch using oob master as the reference
master
Seattle.masterVersion 1.0 master
Seattle.masterVersion 2.0 master
Seattle.masterVersion 3.0
master
contoso.masterVersion 1.0 master
contoso.masterVersion 1.0 master
contoso.masterVersion 1.0
Example: Custom master page and case of an evolving suite bar…
PnP Site Provisioning Framework
Demohttps://github.com/OfficeDev/PnP/tree/master/Samples/Provisioning.Framework.Console
PnP
“Why are you using CSOM/REST for provisioning operations and not feature framework?”
When you provision your changes on top of oob templates using remote APIs, you get always all of the latest capabilities from the services or product.
Summary• What is Office 365 Developer Patterns and Practices (PnP)• Why Do We Need The OfficeDevPnP Initiative ?• Introducing CSOM and The OfficeDevPnP Initiative• What is CSOM ?• What is OfficeDevPnP ?• What Does The OfficeDevPnP Consist Of ?• Remote Provisioning Using OfficeDevPnP• OfficeDevPnP Site Provisioning Framework
It is a community project!Feel free to contribute with Issues,Pull Requests and Yammer threads
“Sharing is caring”
Any Questions ?