`;
34 | }
35 |
36 | protected get dataVersion(): Version {
37 | return Version.parse('1.0');
38 | }
39 |
40 | protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
41 | return {
42 | pages: [
43 | {
44 | header: {
45 | description: strings.PropertyPaneDescription
46 | },
47 | groups: [
48 | {
49 | groupName: strings.BasicGroupName,
50 | groupFields: [
51 | PropertyPaneTextField('description', {
52 | label: strings.DescriptionFieldLabel
53 | })
54 | ]
55 | }
56 | ]
57 | }
58 | ]
59 | };
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/samples/install-spfx-solution/README.md:
--------------------------------------------------------------------------------
1 | # Install SharePoint Framework solution
2 |
3 | ## Summary
4 |
5 | The `installSolution` allows you to install a solution you have deployed to the tenant app catalog and enabled using the new ALM APIs.
6 |
7 | > More details on ALM APIs are available from [official SharePoint Development documentation](https://docs.microsoft.com/en-us/sharepoint/dev/apis/alm-api-for-spfx-add-ins).
8 |
9 | - For this example you need to first upload the solution to the app catalog and enable it.
10 |
11 | 
12 |
13 | - You then need to reference this solution in your InstallSPFXSolution script action. To get the solution ID login to a site using Connect-PnPOnline cmdlet and then run Get-PnPApp. This will return a list of your deployed solutions. Find the one you wish to install via site script and grab that id.
14 |
15 | 
16 |
17 | - After you execute your script, you can confirm that the solution has been installed on the site by moving to site contents view and confirming it's existance.
18 |
19 | 
20 |
21 | - Any SharePoint Framework client-side web part or extension included in the just deployed solution would be now available in the site.
22 |
23 | 
24 |
25 |
26 | > Notice that this `installSPFXSolution` has been designed for solutions which require to be installed on the sites and are not tenant-deployed through tenant app catalog.
27 |
28 |
29 | ## Sample
30 |
31 | Solution|Author(s)
32 | --------|---------
33 | install-appcat-solution | SharePoint Team
34 |
35 | ## Version history
36 |
37 | Version|Date|Comments
38 | -------|----|--------
39 | 1.0|April 10, 2018|Initial release
40 | 1.1|July 16, 2018|Action name has been changed from installSPFXSolution to installSolution
41 |
42 | ## Disclaimer
43 | **THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
44 |
45 | ---
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.PnP.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27130.2024
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Office365.SiteDesigns.PnP", "Office365.SiteDesigns.PnP\Office365.SiteDesigns.PnP.csproj", "{268CC777-EFC9-4F60-ADD6-776FFEA9170C}"
7 | EndProject
8 | Project("{F5034706-568F-408A-B7B3-4D38C6DB8A32}") = "Office365.SiteDesigns.Deployment", "Office365.SiteDesigns.Deployment\Office365.SiteDesigns.Deployment.pssproj", "{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {268CC777-EFC9-4F60-ADD6-776FFEA9170C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {268CC777-EFC9-4F60-ADD6-776FFEA9170C}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {268CC777-EFC9-4F60-ADD6-776FFEA9170C}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {268CC777-EFC9-4F60-ADD6-776FFEA9170C}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {64FB22D1-69AF-49C2-9FD1-EC811659BB3F}
30 | EndGlobalSection
31 | GlobalSection(TeamFoundationVersionControl) = preSolution
32 | SccNumberOfProjects = 3
33 | SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
34 | SccTeamFoundationServer = https://vrdmn.visualstudio.com/
35 | SccLocalPath0 = .
36 | SccProjectUniqueName1 = Office365.SiteDesigns.PnP\\Office365.SiteDesigns.PnP.csproj
37 | SccProjectName1 = Office365.SiteDesigns.PnP
38 | SccLocalPath1 = Office365.SiteDesigns.PnP
39 | SccProjectUniqueName2 = Office365.SiteDesigns.Deployment\\Office365.SiteDesigns.Deployment.pssproj
40 | SccProjectName2 = Office365.SiteDesigns.Deployment
41 | SccLocalPath2 = Office365.SiteDesigns.Deployment
42 | EndGlobalSection
43 | EndGlobal
44 |
--------------------------------------------------------------------------------
/samples/site-azure-function/Install-SampleTheme.ps1:
--------------------------------------------------------------------------------
1 | #
2 | # Install-SampleTheme.ps1
3 | # Installs a custom theme
4 | #
5 |
6 | [CmdletBinding()]
7 | [Diagnostics.CodeAnalysis.SuppressMessage('PSAvoidUsingPlainTextForPassword', '')]
8 | Param(
9 | [Parameter(Mandatory=$True, Position=1,
10 | HelpMessage='Admin site, such as https://mytenant-admin.sharepoint.com')]
11 | [string] $Url,
12 |
13 | [Parameter(Mandatory=$true, ValueFromPipeline=$True,
14 | HelpMessage='Administrative credentials')]
15 | [object] $Credentials,
16 |
17 | [Parameter(HelpMessage='Theme name', Mandatory=$True)]
18 | [string] $ThemeName
19 | )
20 |
21 | # If credentials were not provided, get them now
22 | if ($Credentials -eq $null) {
23 | $Credentials = Get-Credential -Message 'Enter SharePoint Administrator Credentials'
24 | }
25 |
26 | # Connect to the SharePoint admin service
27 | Connect-SPOService -Url $Url -Credential $Credentials
28 |
29 | function HashToDictionary {
30 | Param ([Hashtable]$ht)
31 | $dictionary = New-Object "System.Collections.Generic.Dictionary``2[System.String,System.String]"
32 | foreach ($entry in $ht.GetEnumerator()) {
33 | $dictionary.Add($entry.Name, $entry.Value)
34 | }
35 | return $dictionary
36 | }
37 |
38 | # Define the theme pallette
39 | # JSON generated at https://developer.microsoft.com/en-us/fabric#/styles/themegenerator
40 | $themepallette = HashToDictionary(
41 | @{
42 | "themePrimary" = "#1593cc";
43 | "themeLighterAlt" = "#f2fafe";
44 | "themeLighter" = "#e5f5fc";
45 | "themeLight" = "#cbebfa";
46 | "themeTertiary" = "#92d5f4";
47 | "themeSecondary" = "#17a4e6";
48 | "themeDarkAlt" = "#1283b8";
49 | "themeDark" = "#0e668f";
50 | "themeDarker" = "#0b5070";
51 | "neutralLighterAlt" = "#f8f8f8";
52 | "neutralLighter" = "#f4f4f4";
53 | "neutralLight" = "#eaeaea";
54 | "neutralQuaternaryAlt" = "#dadada";
55 | "neutralQuaternary" = "#d0d0d0";
56 | "neutralTertiaryAlt" = "#c8c8c8";
57 | "neutralTertiary" = "#d6d6d6";
58 | "neutralSecondary" = "#474747";
59 | "neutralPrimaryAlt" = "#2e2e2e";
60 | "neutralPrimary" = "#333333";
61 | "neutralDark" = "#242424";
62 | "black" = "#1c1c1c";
63 | "white" = "#ffffff";
64 | "primaryBackground" = "#ffffff";
65 | "primaryText" = "#333333";
66 | "bodyBackground" = "#ffffff";
67 | "bodyText" = "#333333";
68 | "disabledBackground" = "#f4f4f4";
69 | "disabledText" = "#c8c8c8";
70 | })
71 |
72 | Add-SPOTheme -Name $ThemeName -Palette $themepallette -IsInverted $false
73 |
74 |
75 |
--------------------------------------------------------------------------------
/samples/site-create-advanced-lists2/list-configured-sitecolumn-fieldxml.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "schema.json",
3 | "actions": [
4 | {
5 | "verb": "createSiteColumn",
6 | "fieldType": "User",
7 | "internalName": "siteColumnUser",
8 | "displayName": "Project Owner",
9 | "isRequired": false,
10 | "group": "Contoso Custom Fields",
11 | "enforceUnique": false
12 | },
13 | {
14 | "verb": "createSPList",
15 | "listName": "Contoso Project Tracker",
16 | "templateType": 100,
17 | "subactions":
18 | [
19 | {
20 | "verb": "SetDescription",
21 | "description": "Custom list to illustrate SharePoint site scripting capabilities - spring 2018"
22 | },
23 | {
24 | "verb": "addSiteColumn",
25 | "internalName": "siteColumnUser"
26 | },
27 | {
28 | "verb": "addSPFieldXml",
29 | "schemaXml": "OperationsOperationsITLegalEngineering"
30 | },
31 | {
32 | "verb": "addSPView",
33 | "name": "Contoso Projects by Category",
34 | "viewFields":
35 | [
36 | "ID",
37 | "Title",
38 | "siteColumnUser",
39 | "ProjectCategory"
40 | ],
41 | "query": "",
42 | "rowLimit": 100,
43 | "isPaged": true,
44 | "makeDefault": true
45 | },
46 | {
47 | "verb": "removeSPView",
48 | "name": "All Items"
49 | }
50 | ]
51 | },
52 | {
53 | "verb": "addNavLink",
54 | "url": "/Lists/Contoso Project Tracker",
55 | "displayName": "Contoso Projects",
56 | "isWebRelative": true
57 | }
58 | ],
59 | "bindata": { },
60 | "version": 1
61 | }
--------------------------------------------------------------------------------
/samples/site-create-advanced-lists/README.md:
--------------------------------------------------------------------------------
1 | # Create Advanced Lists
2 |
3 | ## Summary
4 |
5 | This sample illustrates several new advanced list actions and associated sub-actions:
6 |
7 | * `createSiteColumn` - you can now define and add site columns. A site column is a reusable column definition, or template, that you can assign to multiple lists across multiple SharePoint sites. Supported subactions include designating the field type, display name, internal name, column grouping, and whether the field is required and must enforce unique values.
8 |
9 | * `createContentType` - a content type is a reusable collection of metadata (columns) for a category of items or documents in a list or document library. Content types enable you to manage the settings for a category of information in a centralized, reusable way. When defining your content type you can its parent object, whether it is hidden, and what columns it contains. Note: this new action allows for the declaration of a new content type (the ability to reference an enterprise content type is still in development as of April 2018).
10 |
11 | * `addSiteColumn` - use this action to add a site column to a declared content type.
12 |
13 | * `addContentType` - use this action to add your defined content type to a list or library.
14 |
15 | * `addSPView` - you can create custom views of libraries and lists to organize and show items that are most important to you (like certain columns) or to add filtering or sorting. Use this action to specify the desired columns and how you want the items displayed (using a CAML query). Subactions allow you to specify row limits, whether the view is paged, and recurses over items in nested folders or not. You can also designate your constructed view as the default.
16 |
17 | This sample illustrates how to use a site script to modify the default library - adding a constructed content type, an additional site column, an additional list column, and defining a new default view.
18 |
19 | 
20 |
21 |
22 | ## Sample
23 |
24 | Solution|Author(s)
25 | --------|---------
26 | advanced_list_configuration.json | SharePoint Team
27 |
28 | ## Version history
29 |
30 | Version|Date|Comments
31 | -------|----|--------
32 | 1.0|April 10, 2018|Initial release
33 |
34 | ## Disclaimer
35 | **THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
36 |
37 | ---
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.PnP/ApplyPnPTemplate.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Azure.WebJobs;
2 | using Microsoft.Azure.WebJobs.Host;
3 | using Microsoft.SharePoint.Client;
4 | using OfficeDevPnP.Core;
5 | using OfficeDevPnP.Core.Framework.Provisioning.Connectors;
6 | using OfficeDevPnP.Core.Framework.Provisioning.Model;
7 | using OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers;
8 | using OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml;
9 | using System;
10 | using System.Configuration;
11 | using System.IO;
12 |
13 | namespace Office365.SiteDesigns.PnP
14 | {
15 | public static class ApplyPnPTemplate
16 | {
17 | [FunctionName("ApplyPnPTemplate")]
18 | public static void Run([QueueTrigger("cncprovisioningqueue", Connection = "AzureWebJobsDashboard")]string myQueueItem, TraceWriter log, ExecutionContext executionContext)
19 | {
20 | log.Info($"C# Queue trigger function processed: {myQueueItem}");
21 | var authManager = new AuthenticationManager();
22 |
23 | var clientContext = authManager.GetAppOnlyAuthenticatedContext(myQueueItem, ConfigurationManager.AppSettings["ClientId"], ConfigurationManager.AppSettings["ClientSecret"]);
24 |
25 | string currentDirectory = executionContext.FunctionDirectory;
26 | DirectoryInfo dInfo = new DirectoryInfo(currentDirectory);
27 | log.Info("Current directory:" + currentDirectory);
28 | var schemaDir = dInfo.Parent.FullName + "\\PnPSiteSchemas";
29 | log.Info("schemaDir:" + schemaDir);
30 | XMLTemplateProvider sitesProvider = new XMLFileSystemTemplateProvider(schemaDir, "");
31 |
32 | ProvisioningTemplate template = sitesProvider.GetTemplate("SiteCollectionSchema.xml");
33 |
34 | Web web = clientContext.Web;
35 | clientContext.Load(web, w => w.Url);
36 | clientContext.ExecuteQueryRetry();
37 |
38 | log.Info("Applying Provisioning template to site: " + clientContext.Web.Url);
39 |
40 | ProvisioningTemplateApplyingInformation ptai = new ProvisioningTemplateApplyingInformation
41 | {
42 | ProgressDelegate = (message, progress, total) =>
43 | {
44 | log.Info(string.Format("{0:00}/{1:00} - {2}", progress, total, message));
45 | }
46 | };
47 |
48 | // Associate file connector for assets
49 | FileSystemConnector connector = new FileSystemConnector(Path.Combine(currentDirectory, "Files"), "");
50 | template.Connector = connector;
51 |
52 | web.ApplyProvisioningTemplate(template, ptai);
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.Deployment/Office365.SiteDesigns.Deployment.pssproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | Debug
4 | 2.0
5 | 6CAFC0C6-A428-4d30-A9F9-700E829FEA51
6 | Exe
7 | MyApplication
8 | MyApplication
9 | Office365.SiteDesigns.Deployment
10 | SAK
11 | SAK
12 | SAK
13 | SAK
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/samples/site-create-advanced-lists2/README.md:
--------------------------------------------------------------------------------
1 | # Create Advanced Lists - addSPFieldXml usage
2 |
3 | ## Summary
4 |
5 | This sample is another example illustrating several new list actions and associated subactions:
6 |
7 | * `createSiteColumn` - you can now define and add site columns. A site column is a reusable column definition, or template, that you can assign to multiple lists across multiple SharePoint sites. Supported subactions include designating the field type, display name, internal name, column grouping, and whether the field is required and must enforce unique values.
8 |
9 | * `addSiteColumn` - use this action to add a site column to a declared content type.
10 |
11 | * `addSPFieldXml` - this action allows you to use Field element XML to define other internal data types and declare within a site script. Note: as of April 2018 we don't yet allow defining this constructed field as a site column or adding to a content type. For more info see https://msdn.microsoft.com/en-us/library/office/ms437580.aspx
12 |
13 | * `addSPView` - you can create custom views of libraries and lists to organize and show items that are most important to you (like certain columns) or to add filtering or sorting. Use this action to specify the desired columns and how you want the items displayed (using a CAML query). Subactions allow you to specify row limits, whether the view is paged, and recurses over items in nested folders or not. You can also designate your constructed view as the default.
14 |
15 | * `removeSPView` - this action allows you to remove default or created views by name.
16 |
17 |
18 | This sample illustrates these site script actions by creating a custom project tracking list. It declares a site column of data type user and then a choice field for project categories using Field XML. It then constructs a new default view that sorts list records first by project category and then by project owner. It then removes the previous default "all items" view.
19 |
20 |
21 | 
22 |
23 |
24 | ## Sample
25 |
26 | Solution|Author(s)
27 | --------|---------
28 | list-configured-sitecolumn-fieldxml.json | SharePoint Team
29 |
30 | ## Version history
31 |
32 | Version|Date|Comments
33 | -------|----|--------
34 | 1.0|April 10, 2018|Initial release
35 |
36 | ## Disclaimer
37 | **THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
38 |
39 | ---
40 |
41 | All applied actions in the json file as below
42 |
43 | 
44 |
45 |
46 |
--------------------------------------------------------------------------------
/samples/site-azure-function/Install-SampleSiteDesign.ps1:
--------------------------------------------------------------------------------
1 | #
2 | # Install-SampleSiteDesign.ps1
3 | # Installs a custom site design and a site script which runs a Flow
4 | #
5 |
6 | [CmdletBinding()]
7 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword','')]
8 | Param(
9 | [Parameter(Mandatory=$True, Position=1,
10 | HelpMessage='Admin site, such as https://mytenant-admin.sharepoint.com')]
11 | [string] $Url,
12 |
13 | [Parameter(Mandatory=$true, ValueFromPipeline=$True,
14 | HelpMessage='Administrative credentials')]
15 | [object] $Credentials,
16 |
17 | [Parameter(HelpMessage='Site design name')]
18 | [string] $SiteDesignName = 'Sample department site',
19 |
20 | [Parameter(HelpMessage='Site script name')]
21 | [string] $SiteScriptName = 'Sample',
22 |
23 | [Parameter(HelpMessage='Description of site design and script')]
24 | [string] $Description = 'Sample departmental site',
25 |
26 | [Parameter(HelpMessage='URL of site logo', Mandatory=$True)]
27 | [string] $LogoUrl,
28 |
29 | [Parameter(HelpMessage='Theme name', Mandatory=$True)]
30 | [string] $ThemeName,
31 |
32 | [Parameter(HelpMessage='Flow Trigger Url', Mandatory=$True)]
33 | [string] $FlowTriggerUrl = ''
34 | )
35 |
36 | # If credentials were not provided, get them now
37 | if ($Credentials -eq $null) {
38 | $Credentials = Get-Credential -Message 'Enter SharePoint Administrator Credentials'
39 | }
40 |
41 | # Connect to the SharePoint admin service
42 | Connect-SPOService -Url $Url -Credential $Credentials
43 |
44 | # Show existing site designs
45 | Get-SPOSiteDesign
46 |
47 | # Clean up from any previous runs
48 | Get-SPOSiteDesign | Where-Object {$_.Title -eq $SiteDesignName} | Remove-SPOSiteDesign
49 | Get-SPOSiteScript | Where-Object {$_.Title -eq $SiteScriptName} | Remove-SPOSiteScript
50 |
51 | # Define a recipe and site design
52 | $scriptJson = @"
53 | {
54 | '$schema': 'schema.json',
55 | 'actions':
56 | [
57 | {
58 | 'verb': 'setSiteLogo',
59 | 'url': '${LogoUrl}'
60 | },
61 | {
62 | 'verb': 'applyTheme',
63 | 'themeName': '${ThemeName}'
64 | },
65 | {
66 | 'verb': 'triggerFlow',
67 | 'url': '${FlowTriggerUrl}',
68 | 'name': 'Running Flow',
69 | 'parameters': {
70 | 'event': '',
71 | 'product': ''
72 | }
73 | }
74 | ],
75 | 'bindata': { },
76 | 'version': 1
77 | };
78 | "@
79 |
80 | Add-SPOSiteScript -Title $SiteScriptName -Description $Description -Content $scriptJson
81 | $siteScript = Get-SPOSiteScript | Where-Object {$_.Title -eq $SiteScriptName}
82 |
83 | Add-SPOSiteDesign -Title $SiteDesignName -WebTemplate '68' -SiteScripts $siteScript -Description $Description
84 |
85 |
86 |
--------------------------------------------------------------------------------
/samples/triggerFlow-write-back-site-properties-to-splist/README.md:
--------------------------------------------------------------------------------
1 | # Additional site information with triggerFlow action
2 |
3 | ## Summary
4 |
5 | We have amended the `triggerFlow` site action to pass additional site information. These properties can be associated to variables in the JSON request body of a HTTP request Flow action and then used as dynamic content in other Flow actions like email and list objects.
6 | These properties are automatically sent from the site provisioning engine. In other words: you don't have to explicitly write these properties in the sitescript-file.
7 |
8 | The properties that you can use are the following:
9 | - webUrl
10 | - creatorName
11 | - creatorEmail
12 | - webDescription
13 | - createdTimeUTC
14 |
15 | In this example you can use the included JSON in your HTTP Request action request body and then insert a new step like create SharePoint list item. First create the SharePoint list so you can reference it in the create item Flow action. Your list should include fields for each of the triggerFlow properties you'd like to capture. For this example you need to create a list to capture all sites created with this site design and script using a triggerFlow):
16 |
17 | - Create a list with the following properties:
18 | - *Web Url* (maps to webUrl)
19 | - *CreatedBy* (maps to creatorName)
20 | - *CreatorEmail* (maps to creatorEmail)
21 | - *webDescription* (maps to webDescription)
22 | - *creationTimeUTC* (maps to createdTimeUTC)
23 |
24 | - create a Flow that includes two steps:
25 | - When a HTTP Request is received (this action will use the include JSON for the request body. You can get the HTTP Post Url for your triggerFlow action after saving the flow)
26 | - Create item - SharePoint (this action will allow you to specify the list you created above. after you point it to the correct list you'll be able to map the list columns to the site properties as dynamic content.
27 |
28 | After you save your Flow and update your triggerFlow action subsequent uses of this script will write back the site information as illustrated in the sample screenshot.
29 |
30 | 
31 |
32 | ## Sample
33 |
34 | Solution|Author(s)
35 | --------|---------
36 | request-body-json-schema.json | SharePoint Team
37 |
38 | ## Version history
39 |
40 | Version|Date|Comments
41 | -------|----|--------
42 | 1.0|April 10, 2018|Initial release
43 |
44 | ## Disclaimer
45 | **THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
46 |
47 | ---
48 |
49 | ## Additional notes
50 |
51 | This sample is covered in the main documentation on the Site Designs and Site Scripts.
52 |
53 | - [SharePoint site design and site script overview](https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-overview)
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/src/extensions/footer/FooterApplicationCustomizer.ts:
--------------------------------------------------------------------------------
1 | import { override } from '@microsoft/decorators';
2 | import { Log } from '@microsoft/sp-core-library';
3 | import {
4 | BaseApplicationCustomizer,
5 | PlaceholderContent,
6 | PlaceholderName
7 | } from '@microsoft/sp-application-base';
8 |
9 | import * as strings from 'FooterApplicationCustomizerStrings';
10 | import styles from './FooterApplicationCustomizer.module.scss';
11 | import { escape } from '@microsoft/sp-lodash-subset';
12 |
13 | const LOG_SOURCE: string = 'FooterApplicationCustomizer';
14 |
15 | /**
16 | * If your command set uses the ClientSideComponentProperties JSON input,
17 | * it will be deserialized into the BaseExtension.properties object.
18 | * You can define an interface to describe it.
19 | */
20 | export interface IFooterApplicationCustomizerProperties {
21 | Bottom: string;
22 | }
23 |
24 | /** A Custom Action which can be run during execution of a Client Side Application */
25 | export default class FooterApplicationCustomizer
26 | extends BaseApplicationCustomizer {
27 |
28 | private _bottomPlaceholder: PlaceholderContent | undefined;
29 |
30 | @override
31 | public onInit(): Promise {
32 | Log.info(LOG_SOURCE, `Initialized ${strings.Title}`);
33 |
34 | // Added to handle possible changes on the existence of placeholders.
35 | this.context.placeholderProvider.changedEvent.add(this, this._renderPlaceHolders);
36 |
37 | // Call render method for generating the HTML elements.
38 | this._renderPlaceHolders();
39 |
40 | return Promise.resolve();
41 | }
42 |
43 | private _renderPlaceHolders(): void {
44 | console.log('Available placeholders: ',
45 | this.context.placeholderProvider.placeholderNames.map(name => PlaceholderName[name]).join(', '));
46 |
47 | // Handling the bottom placeholder
48 | if (!this._bottomPlaceholder) {
49 | this._bottomPlaceholder =
50 | this.context.placeholderProvider.tryCreateContent(
51 | PlaceholderName.Bottom,
52 | { onDispose: this._onDispose });
53 |
54 | // The extension should not assume that the expected placeholder is available.
55 | if (!this._bottomPlaceholder) {
56 | console.error('The expected placeholder (Bottom) was not found.');
57 | return;
58 | }
59 |
60 | if (this.properties) {
61 | let bottomString: string = this.properties.Bottom;
62 | if (!bottomString) {
63 | bottomString = '(Bottom property was not defined.)';
64 | }
65 |
66 | if (this._bottomPlaceholder.domElement) {
67 | this._bottomPlaceholder.domElement.innerHTML = `
68 |
69 |
70 | ${escape(bottomString)}
71 |
72 |
`;
73 | }
74 | }
75 | }
76 | }
77 |
78 | private _onDispose(): void {
79 | console.log('Disposed custom bottom placeholders.');
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/samples/site-apply-company-theme/README.md:
--------------------------------------------------------------------------------
1 | # Applying custom theme
2 |
3 | ## Summary
4 | You can use a site script to apply a company theme to a modern site. The following example uses the applyTheme action to set a pre-loaded company theme after site creation. This action requires simply referencing a company theme name, so one must be first installed to your tenant gallery. For more details on this check out https://aka.ms/spsitetheming - and if you need help creating a theme be sure to check out the theme generator at https://aka.ms/spthemebuilder.
5 |
6 | 
7 |
8 | ## Sample
9 |
10 | Solution|Author(s)
11 | --------|---------
12 | site-apply-company-theme | SharePoint Team
13 |
14 | ## Version history
15 |
16 | Version|Date|Comments
17 | -------|----|--------
18 | 1.0|December 14, 2017|Initial release
19 |
20 | ## Disclaimer
21 | **THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
22 |
23 | ---
24 |
25 | ## Additional notes
26 |
27 | Here is a sample theme you can use to try this out:
28 |
29 | ```ps
30 | $ContosoThemeSample=
31 | @{
32 | "themePrimary" = "#3ad600";
33 | "themeLighterAlt" = "#f4fff0";
34 | "themeLighter" = "#e9ffe1";
35 | "themeLight" = "#d4ffc4";
36 | "themeTertiary" = "#a4ff83";
37 | "themeSecondary" = "#41f400";
38 | "themeDarkAlt" = "#33c100";
39 | "themeDark" = "#289600";
40 | "themeDarker" = "#1f7600";
41 | "neutralLighterAlt" = "#ececec";
42 | "neutralLighter" = "#e8e8e8";
43 | "neutralLight" = "#dedede";
44 | "neutralQuaternaryAlt" = "#cfcfcf";
45 | "neutralQuaternary" = "#c6c6c6";
46 | "neutralTertiaryAlt" = "#bebebe";
47 | "neutralTertiary" = "#d6d6d6";
48 | "neutralSecondary" = "#474747";
49 | "neutralPrimaryAlt" = "#2e2e2e";
50 | "neutralPrimary" = "#333333";
51 | "neutralDark" = "#242424";
52 | "black" = "#1c1c1c";
53 | "white" = "#f1f1f1";
54 | "primaryBackground" = "#f1f1f1";
55 | "primaryText" = "#333333";
56 | "bodyBackground" = "#f1f1f1";
57 | "bodyText" = "#333333";
58 | "disabledBackground" = "#e8e8e8";
59 | "disabledText" = "#bebebe";
60 | "accent" = "#0072d6"
61 | }
62 | ```
63 |
64 | You can apply using the following PowerShell command:
65 |
66 | ```ps
67 | Add-SPOTheme -Name "Company Theme Sample" -Palette $ContosoThemeSample -IsInverted $false
68 | ```
69 |
70 | And then reference in your site script JSON:
71 |
72 | ```json
73 | var applyCompanyTheme =
74 | {
75 | "$schema": "schema.json",
76 | "actions": [
77 | {
78 | "verb": "applyTheme",
79 | themeName: "Company Theme Sample"
80 | }
81 | ],
82 | "bindata": { },
83 | "version": 1
84 | };
85 | ```
86 |
87 | You can create a site script with this action using REST or PowerShell - and then reference the returned in a site design, using either web template 64 (group-connected team) or 68 (communication).
88 |
89 | This sample is covered in the main documentation aroud Site Designs and Site Scripts.
90 |
91 | - [SharePoint site design and site script overview](https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-overview)
92 |
93 |
94 |
--------------------------------------------------------------------------------
/samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.Deployment/Deploy.ps1:
--------------------------------------------------------------------------------
1 | ###Authenticaiton###
2 | Connect-SPOService -Url "https://tenant-admin.sharepoint.com"
3 |
4 | #Cleanup any existing site scripts and site designs
5 | #Get-SPOSiteDesign | Remove-SPOSiteDesign
6 | #Get-SPOSiteScript | Remove-SPOSiteScript
7 |
8 | ###Site Scripts###
9 | #Get the content of the JSON file and add it to the site script.
10 | $siteScriptListContent = Get-Content 'SiteScripts\site-script-lists.json' -Raw
11 | $siteScriptList = Add-SPOSiteScript -Title "CnC Lists" -Description "Adds a custom document library to the site" -Content $siteScriptListContent
12 |
13 | #Get the content of the JSON file and add it to the site script.
14 | $siteScriptTriggerFlowContent = Get-Content 'SiteScripts\site-script-triggerFlow.json' -Raw
15 | $siteScriptTriggerFlow = Add-SPOSiteScript -Title "CnC Trigger Flow" -Description "Triggers a Microsoft Flow" -Content $siteScriptTriggerFlowContent
16 |
17 | #Get the content of the JSON file and add it to the site script.
18 | $siteScriptThemeContent = Get-Content 'SiteScripts\site-script-theme.json' -Raw
19 | $siteScriptTheme = Add-SPOSiteScript -Title "CnC Theme Script" -Description "Adds a custom theme to the site" -Content $siteScriptThemeContent
20 |
21 | $siteScriptSPFxContent = Get-Content 'SiteScripts\site-script-spfxComponents.json' -Raw
22 | $siteScriptSPFx = Add-SPOSiteScript -Title "CnC SPFx Script" -Description "Adds SPFx components to the site" -Content $siteScriptSPFxContent
23 |
24 | $siteScriptJoinToHubContent = Get-Content 'SiteScripts\site-script-joinToHub.json' -Raw
25 | $siteScriptJoinToHub = Add-SPOSiteScript -Title "CnC Join to Hub" -Description "Join site to Hub" -Content $siteScriptJoinToHubContent
26 |
27 | $siteScriptSharingContent = Get-Content 'SiteScripts\site-script-externalSharing.json' -Raw
28 | $siteScriptSharing = Add-SPOSiteScript -Title "CnC External Sharing" -Description "Join site to Hub" -Content $siteScriptSharingContent
29 |
30 |
31 | ###Site Designs###
32 | #Create a basic site design only using the lists and theme site script.
33 | Add-SPOSiteDesign -Title "CnC Office 365 Group site" -WebTemplate "64" -IsDefault -SiteScripts $siteScriptTheme.ID, $siteScriptList.ID, $siteScriptSharing.ID -Description "CnC custom site connected to Office 365 Group" -PreviewImageUrl "https://tenant.sharepoint.com/SiteAssets/cncsitepreview.png" -PreviewImageAltText "CnC custom site logo"
34 |
35 | Add-SPOSiteDesign -Title "CnC Basic Communication site" -WebTemplate "68" -SiteScripts $siteScriptTheme.ID, $siteScriptList.ID, $siteScriptSPFx.ID, $siteScriptSharing.ID -Description "CnC basic communication site" -PreviewImageUrl "https://tenant.sharepoint.com/SiteAssets/cncsitepreview.png"
36 |
37 | #Create an advanced site design by using the theme, lists and flow site scripts
38 | Add-SPOSiteDesign -Title "CnC Advanced Communication site" -WebTemplate "68" -SiteScripts $siteScriptTheme.ID, $siteScriptList.ID, $siteScriptTriggerFlow.ID -Description "CnC advanced communication site" -PreviewImageUrl "https://tenant.sharepoint.com/SiteAssets/cncsitepreview.png"
39 |
40 | Add-SPOSiteDesign -Title "CnC Department site" -WebTemplate "68" -SiteScripts $siteScriptJoinToHub.ID -Description "Department site will be joined to Hub" -PreviewImageUrl "https://tenant.sharepoint.com/SiteAssets/cncsitepreview.png"
41 |
42 |
43 |
--------------------------------------------------------------------------------
/samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.PnP/PnPSiteSchemas/SiteCollectionSchema.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.Deployment/Utilities/CreateAzureResourceGroup.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Deploys a template to Azure
4 |
5 | .DESCRIPTION
6 | Deploys an Azure Resource Manager template
7 |
8 | .PARAMETER subscriptionId
9 | The subscription id where the template will be deployed.
10 |
11 | .PARAMETER resourceGroupName
12 | The resource group where the template will be deployed. Can be the name of an existing or a new resource group.
13 |
14 | .PARAMETER resourceGroupLocation
15 | Optional, a resource group location. If specified, will try to create a new resource group in this location. If not specified, assumes resource group is existing.
16 |
17 | .PARAMETER deploymentName
18 | The deployment name.
19 |
20 | .PARAMETER templateFilePath
21 | Optional, path to the template file. Defaults to template.json.
22 |
23 | .PARAMETER parametersFilePath
24 | Optional, path to the parameters file. Defaults to parameters.json. If file is not found, will prompt for parameter values based on template.
25 | #>
26 |
27 | param(
28 | [Parameter(Mandatory=$True)]
29 | [string]
30 | $subscriptionId,
31 |
32 | [Parameter(Mandatory=$True)]
33 | [string]
34 | $resourceGroupName,
35 |
36 | [string]
37 | $resourceGroupLocation,
38 |
39 | [Parameter(Mandatory=$True)]
40 | [string]
41 | $deploymentName,
42 |
43 | [string]
44 | $templateFilePath = "template.json",
45 |
46 | [string]
47 | $parametersFilePath = "parameters.json"
48 | )
49 |
50 | <#
51 | .SYNOPSIS
52 | Registers RPs
53 | #>
54 | Function RegisterRP {
55 | Param(
56 | [string]$ResourceProviderNamespace
57 | )
58 |
59 | Write-Host "Registering resource provider '$ResourceProviderNamespace'";
60 | Register-AzureRmResourceProvider -ProviderNamespace $ResourceProviderNamespace;
61 | }
62 |
63 | #******************************************************************************
64 | # Script body
65 | # Execution begins here
66 | #******************************************************************************
67 | $ErrorActionPreference = "Stop"
68 |
69 | # sign in
70 | Write-Host "Logging in...";
71 | Login-AzureRmAccount;
72 |
73 | # select subscription
74 | Write-Host "Selecting subscription '$subscriptionId'";
75 | Select-AzureRmSubscription -SubscriptionID $subscriptionId;
76 |
77 | # Register RPs
78 | $resourceProviders = @("microsoft.storage","microsoft.web");
79 | if($resourceProviders.length) {
80 | Write-Host "Registering resource providers"
81 | foreach($resourceProvider in $resourceProviders) {
82 | RegisterRP($resourceProvider);
83 | }
84 | }
85 |
86 | #Create or check for existing resource group
87 | $resourceGroup = Get-AzureRmResourceGroup -Name $resourceGroupName -ErrorAction SilentlyContinue
88 | if(!$resourceGroup)
89 | {
90 | Write-Host "Resource group '$resourceGroupName' does not exist. To create a new resource group, please enter a location.";
91 | if(!$resourceGroupLocation) {
92 | $resourceGroupLocation = Read-Host "resourceGroupLocation";
93 | }
94 | Write-Host "Creating resource group '$resourceGroupName' in location '$resourceGroupLocation'";
95 | New-AzureRmResourceGroup -Name $resourceGroupName -Location $resourceGroupLocation
96 | }
97 | else{
98 | Write-Host "Using existing resource group '$resourceGroupName'";
99 | }
100 |
101 | # Start the deployment
102 | Write-Host "Starting deployment...";
103 | if(Test-Path $parametersFilePath) {
104 | New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile $templateFilePath -TemplateParameterFile $parametersFilePath;
105 | } else {
106 | New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile $templateFilePath;
107 | }
--------------------------------------------------------------------------------
/samples/site-create-advanced-lists/advanced_list_configuration.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "schema.json",
3 | "actions": [
4 | {
5 | "verb": "createSiteColumn",
6 | "fieldType": "Text",
7 | "internalName": "siteColumn1Text",
8 | "displayName": "Project Status",
9 | "isRequired": false,
10 | "group": "Contoso Custom",
11 | "enforceUnique": true
12 | },
13 | {
14 | "verb": "createSiteColumn",
15 | "fieldType": "Number",
16 | "internalName": "siteColumn2Number",
17 | "displayName": "Effort in Days",
18 | "isRequired": false
19 | },
20 | {
21 | "verb": "createSiteColumn",
22 | "fieldType": "Note",
23 | "internalName": "siteColumn3Note",
24 | "displayName": "Meeting Notes",
25 | "isRequired": false
26 | },
27 | {
28 | "verb": "createSiteColumn",
29 | "fieldType": "User",
30 | "internalName": "siteColumn4User",
31 | "displayName": "Project Owner",
32 | "isRequired": false
33 | },
34 | {
35 | "verb": "createContentType",
36 | "name": "Contoso Projects",
37 | "description": "custom list content type",
38 | "parentName": "Item",
39 | "hidden": false,
40 | "subactions":
41 | [
42 | {
43 | "verb": "addSiteColumn",
44 | "internalName": "siteColumn1Text"
45 | },
46 | {
47 | "verb": "addSiteColumn",
48 | "internalName": "siteColumn2Number"
49 | },
50 | {
51 | "verb": "addSiteColumn",
52 | "internalName": "siteColumn3Note"
53 | }
54 | ]
55 | },
56 | {
57 | "verb": "createSPList",
58 | "listName": "Documents",
59 | "templateType": 101,
60 | "subactions":
61 | [
62 | {
63 | "verb": "setDescription",
64 | "description": "Custom document library to illustrate SharePoint site scripting capabilities - spring 2018"
65 | },
66 | {
67 | "verb": "addContentType",
68 | "name": "Contoso Projects"
69 | },
70 | {
71 | "verb": "addSiteColumn",
72 | "internalName": "siteColumn4User",
73 | "addToDefaultView": true
74 | },
75 | {
76 | "verb": "addSPField",
77 | "fieldType": "DateTime",
78 | "displayName": "Delivery Date",
79 | "internalName": "spField1DateTime",
80 | "isRequired": true,
81 | "addToDefaultView": true
82 | },
83 | {
84 | "verb": "addSPView",
85 | "name": "Contoso Projects by Effort",
86 | "viewFields":
87 | [
88 | "ID",
89 | "Title",
90 | "siteColumn1Text",
91 | "siteColumn2Number",
92 | "siteColumn3Note",
93 | "siteColumn4User",
94 | "spField1DateTime"
95 | ],
96 | "query": "5",
97 | "rowLimit": 100,
98 | "isPaged": true,
99 | "makeDefault": true
100 | }
101 | ]
102 | }
103 | ],
104 | "bindata": { },
105 | "version": 1
106 | }
107 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contribution Guidance
2 | If you'd like to contribute to this repository, please read the following guidelines. Contributors are more than welcome to share your learnings with others from centralized location.
3 |
4 | ## Code of Conduct
5 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
6 | For more information, see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
7 | or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
8 |
9 | ## Question or Problem?
10 | Please do not open GitHub issues for general support questions as the GitHub list should be used for feature requests and bug reports. This way we can more easily track actual issues or bugs from the code and keep the general discussion separate from the actual code.
11 |
12 | If you have questions about column formatting, feel also free to use following channels for having an open discussion with the community and engineering.
13 |
14 | * [SharePoint Developer Space](http://aka.ms/SPPnP-Community) at http://techcommunity.microsoft.com
15 | * [SharePoint Stack Exchange](http://sharepoint.stackexchange.com/) with 'spfx' tag
16 |
17 | ## Typos, Issues, Bugs and contributions
18 | Whenever you are submitting any changes to the SharePoint repositories, please follow these recommendations.
19 |
20 | * Always fork repository to your own account for applying modifications
21 | * If you are submitting multiple samples, please create specific pull request for each of them
22 | * If you are submitting typo or documentation fix, you can combine modifications to single pull request where suitable
23 |
24 | ## Submitting changes as pull requests
25 | Here's a high level process for submitting new samples or updates to existing ones.
26 |
27 | 1. Sign the Contributor License Agreement (see below)
28 | 2. Fork the main repository to your GitHub account
29 | 3. Create a new branch for your fork for the contribution based on dev branch
30 | 4. Include your changes to your branch
31 | 5. Commit your changes using descriptive commit message - These are used to track changes on the repositories for monthly communications, see [October 2017](https://dev.office.com/blogs/PnP-December-2017-Release) as an example
32 | 6. Create a pull request in your own fork and target 'master' branch
33 | 7. Fill up the provided Pull Request template with the requested details
34 |
35 | > note. Delete the feature specific branch only AFTER your pull request has been processed.
36 |
37 | ## Sample naming and structure guidelines
38 | When you are submitting a new sample, it has to follow up below guidelines
39 |
40 | - You will need to have a README file for your sample, which is based on [provided template](../samples/README-template.md) under the Samples folder. Please copy this template and update accordingly. README has to be named as README.md with capital letters.
41 | - You will need to have a picture of the sample in practice in the README file ("pics or it didn't happen"). Preview image should present how the site looks when provisioning is completed
42 | - README template contains specific tracking image as a final entry in the page with img tag by default to https://telemetry.sharepointpnp.com/sp-dev-site-script/samples/readme-template. This is transparent image, which is used to track popularity of individual samples in GitHub.
43 | - Updated the image src element according with repository name and folder information. If your sample is for example in samples folder and named as react-todo, src element should be updated as https://telemetry.sharepointpnp.com/sp-dev-site-script/samples/flow-start
44 | - When you are submitting new sample solution, please name the sample solution folder accordingly
45 | - Folder name should start by identifying if the site design uses flow or not - like "flow-", "site-"
46 | - After prefix, you should use description short term to define what script does like "site-create-list"
47 | - Do not use terms like "script", "design", "template" in the folder name
48 | - Do not use period/dot in the folder name of the provided sample
49 |
50 | ## Signing the CLA
51 | Before we can accept your pull requests you will be asked to sign electronically Contributor License Agreement (CLA), which is prerequisite for any contributions to PnP repository. This will be one time process, so for any future contributions you will not be asked to re-sign anything. After the CLA has been signed, our PnP core team members will have a look on your submission for final verification of the submission. Please do not delete your development branch until the submission has been closed.
52 |
53 | You can find Microsoft CLA from the following address - https://cla.microsoft.com.
54 |
55 | Thank you for your contribution.
56 |
57 | > Sharing is caring.
--------------------------------------------------------------------------------
/samples/site-create-lists-add-to-site-nav/create-list-add-links-to-sitenav.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "schema.json",
3 | "actions": [
4 | {
5 | "verb": "createSPList",
6 | "listName": "Custom List",
7 | "templateType": 100,
8 | "subactions": [
9 | {
10 | "verb": "SetDescription",
11 | "description": "Custom list to illustrate SharePoint site scripting"
12 | },
13 | {
14 | "verb": "addSPField",
15 | "fieldType": "Text",
16 | "displayName": "Text Field",
17 | "isRequired": false,
18 | "addToDefaultView": true
19 | },
20 | {
21 | "verb": "addSPField",
22 | "fieldType": "Number",
23 | "displayName": "Number Field",
24 | "addToDefaultView": true,
25 | "isRequired": true
26 | },
27 | {
28 | "verb": "addSPField",
29 | "fieldType": "User",
30 | "displayName": "User Field",
31 | "addToDefaultView": true,
32 | "isRequired": true
33 | },
34 | {
35 | "verb": "addSPField",
36 | "fieldType": "Note",
37 | "displayName": "Note Field",
38 | "isRequired": false
39 | },
40 | {
41 | "verb": "addSPField",
42 | "fieldType": "Boolean",
43 | "displayName": "Boolean Field",
44 | "isRequired": false
45 | },
46 | {
47 | "verb": "addSPField",
48 | "fieldType": "DateTime",
49 | "displayName": "Date Time Field",
50 | "isRequired": false
51 | }
52 | ]
53 | },
54 | {
55 | "verb": "createSPList",
56 | "listName": "Custom Library",
57 | "templateType": 101,
58 | "subactions": [
59 | {
60 | "verb": "SetDescription",
61 | "description": "Document library to illustrate SharePoint site scripting"
62 | },
63 | {
64 | "verb": "addSPField",
65 | "fieldType": "Text",
66 | "displayName": "Text Field",
67 | "isRequired": false,
68 | "addToDefaultView": true
69 | },
70 | {
71 | "verb": "addSPField",
72 | "fieldType": "Number",
73 | "displayName": "Number Field",
74 | "addToDefaultView": true,
75 | "isRequired": true
76 | },
77 | {
78 | "verb": "addSPField",
79 | "fieldType": "User",
80 | "displayName": "User Field",
81 | "addToDefaultView": true,
82 | "isRequired": true
83 | },
84 | {
85 | "verb": "addSPField",
86 | "fieldType": "Note",
87 | "displayName": "Note Field",
88 | "isRequired": false
89 | },
90 | {
91 | "verb": "addSPField",
92 | "fieldType": "Boolean",
93 | "displayName": "Boolean Field",
94 | "isRequired": false
95 | },
96 | {
97 | "verb": "addSPField",
98 | "fieldType": "DateTime",
99 | "displayName": "Date Time Field",
100 | "isRequired": false
101 | },
102 | {
103 | "verb": "addSPField",
104 | "fieldType": "Text",
105 | "displayName": "Text A Field",
106 | "isRequired": false,
107 | "addToDefaultView": true
108 | },
109 | {
110 | "verb": "deleteSPField",
111 | "fieldType": "Text",
112 | "displayName": "Text A Field",
113 | "isRequired": false,
114 | "addToDefaultView": true
115 | }
116 | ]
117 | },
118 | {
119 | "verb": "addNavLink",
120 | "url": "/Custom Library",
121 | "displayName": "Custom Library",
122 | "isWebRelative": true
123 | },
124 | {
125 | "verb": "addNavLink",
126 | "url": "/Lists/Custom List",
127 | "displayName": "Custom List",
128 | "isWebRelative": true
129 | }
130 |
131 | ],
132 | "bindata": { },
133 | "version": 1
134 | }
--------------------------------------------------------------------------------
/samples/site-azure-function/SetupDepartmentSite/run.ps1:
--------------------------------------------------------------------------------
1 | $webUrl = Get-Content $triggerInput -Raw
2 |
3 | Connect-PnPOnline -url $webUrl -AppId $env:SPO_AppId -AppSecret $env:SPO_AppSecret
4 |
5 | # Set up home page
6 | # Section 1
7 | $props = @'
8 | {
9 | "layoutCategory": 1,
10 | "layout": 5,
11 | "content": [
12 | {
13 | "id": "e38b7aa6-a9cd-47eb-9ef2-efb5f7084bcf",
14 | "type": "UrlLink",
15 | "color": 4,
16 | "image": {},
17 | "description": "",
18 | "showDescription": false,
19 | "showTitle": true,
20 | "imageDisplayOption": 3,
21 | "isDefaultImage": true,
22 | "showCallToAction": true,
23 | "isDefaultImageLoaded": false,
24 | "isCustomImageLoaded": true,
25 | "previewImage": {}
26 | },
27 | {
28 | "id": "8adee762-0dc5-48fd-94ef-eb391e8ec58f",
29 | "type": "UrlLink",
30 | "color": 5,
31 | "image": {},
32 | "description": "",
33 | "showDescription": false,
34 | "showTitle": true,
35 | "imageDisplayOption": 2,
36 | "isDefaultImage": true,
37 | "showCallToAction": false,
38 | "isDefaultImageLoaded": false,
39 | "isCustomImageLoaded": true,
40 | "previewImage": {}
41 | },
42 | {
43 | "id": "cc618d86-dc33-4742-9df0-e2f714df1f78",
44 | "type": "UrlLink",
45 | "color": 4,
46 | "image": {},
47 | "description": "",
48 | "showDescription": false,
49 | "showTitle": true,
50 | "imageDisplayOption": 3,
51 | "isDefaultImage": true,
52 | "showCallToAction": false,
53 | "isDefaultImageLoaded": false,
54 | "isCustomImageLoaded": true,
55 | "previewImage": {}
56 | },
57 | {
58 | "id": "a1098565-46ce-45a3-ad6f-e2c350cd2ddc",
59 | "type": "UrlLink",
60 | "color": 4,
61 | "image": {},
62 | "description": "",
63 | "showDescription": false,
64 | "showTitle": true,
65 | "imageDisplayOption": 3,
66 | "isDefaultImage": true,
67 | "showCallToAction": false,
68 | "isDefaultImageLoaded": false,
69 | "isCustomImageLoaded": true,
70 | "previewImage": {}
71 | },
72 | {
73 | "id": "9d2f7147-4b93-478a-8e2a-c1d7d20356b2",
74 | "type": "UrlLink",
75 | "color": 4,
76 | "image": {},
77 | "description": "",
78 | "showDescription": false,
79 | "showTitle": true,
80 | "imageDisplayOption": 3,
81 | "isDefaultImage": true,
82 | "showCallToAction": false,
83 | "isDefaultImageLoaded": false,
84 | "isCustomImageLoaded": true,
85 | "previewImage": {}
86 | }
87 | ],
88 | "isFullWidth": true
89 | }
90 | '@
91 |
92 | Add-PnPClientSidePageSection -Page "Home.aspx" -SectionTemplate OneColumn -Order 1
93 | Add-PnPClientSideWebPart -Page "Home.aspx" -Section 1 -Column 1 -DefaultWebPartType Hero -WebPartProperties $props
94 | Write-Output "Section 1 set up"
95 |
96 | # Section 2
97 | Add-PnPClientSidePageSection -Page "Home.aspx" -SectionTemplate TwoColumnLeft -Order 2
98 | Add-PnPClientSideWebPart -Page "Home.aspx" -Section 2 -Column 1 -DefaultWebPartType NewsFeed
99 | $props = '{"listQuery":"","title":"Frequently Needed","layoutMode":0,"hubLinksItems":[{"index":0,"Title":"Link","URL":null,"Description":"Description of Link","Icon":null,"NewTab":false,"GroupBy":""},{"index":null,"Title":"Link","URL":null,"Description":"Description of Link","Icon":null,"NewTab":false,"GroupBy":""},{"index":null,"Title":"Link","URL":null,"Description":"Description of Link","Icon":null,"NewTab":false,"GroupBy":""}],"groups":[],"version":"1.0"}'
100 | Add-PnPClientSideWebPart -Page "Home.aspx" -Section 2 -Column 2 -Order 1 -Component "Hub Links List" -WebPartProperties $props
101 | $props = '{"data":[{"name":"POLICIES","isBlue":true,"icon":"","url":"http://www.microsoft.com","openNew":false}],"title":"","advancedCamlQuery":""}'
102 | Add-PnPClientSideWebPart -Page "Home.aspx" -Section 2 -Column 2 -Order 2 -Component "Hub Box Button" -WebPartProperties $props
103 | $props = "{'listQuery':'','title':'About','layoutMode':0,'hubLinksItems':[{'index':null,'Title':'About Us','URL':'${$webUrl}About.aspx','Description':'About our department','Icon':'fa-book','NewTab':false,'GroupBy':''}],'groups':[],'version':'1.0'}"
104 | Add-PnPClientSideWebPart -Page "Home.aspx" -Section 2 -Column 2 -Order 3 -Component "Hub Links List" -WebPartProperties $props
105 | Write-Output "Section 2 set up"
106 |
107 | #Section 3
108 | Add-PnPClientSidePageSection -Page "Home.aspx" -SectionTemplate OneColumn -Order 3
109 | Add-PnPClientSideWebPart -Page "Home.aspx" -Section 3 -Column 1 -DefaultWebPartType Events
110 | $props = '{"title":"Site Owner","layout":1,"persons":[]}'
111 | Add-PnPClientSideWebPart -Page "Home.aspx" -Section 3 -Column 1 -DefaultWebPartType People -WebPartProperties $props
112 | Write-Output "Section 3 set up"
113 |
114 | # Set up About page
115 | Add-PnPClientSidePage -Name "About.aspx" -LayoutType Article -CommentsEnabled -PublishMessage "Published" -ErrorAction SilentlyContinue
116 | Write-Output "About page set up"
117 |
118 | # Set All Pages view
119 | # Set up pages view
120 | $context = Get-PnPContext
121 | $list = Get-PnPList -Identity "Site Pages"
122 | $view = Get-PnPView -List $list -Identity "All Pages"
123 | Write-Output "All Pages view set up"
124 |
125 | $view.ViewFields.Add("CheckoutUser")
126 | $view.ViewFields.Add("Version")
127 | $view.ViewQuery = ''
128 | $view.Update()
129 | $context.ExecuteQuery()
130 |
131 | # Get title for output
132 | $web = Get-PnPWeb
133 | $title = $web.Title
134 | Write-Output "Completed provisioning $title at $webUrl"
--------------------------------------------------------------------------------
/samples/site-azure-function/README.md:
--------------------------------------------------------------------------------
1 | # SharePoint Swoop Reality Show Sample
2 | ## Triggers Flow to run an Azure function containing PnP PowerShell
3 |
4 | ## Summary
5 |
6 | This sample shows how to build a site design and script for a simple department site, as created in the [SharePoint Swoop video](https://techcommunity.microsoft.com/t5/Microsoft-SharePoint-Blog/SharePoint-Swoop-the-intranet-makeover-show/ba-p/186892). A team of experts worked with [Funko Toys](https://www.funko.com/) to redesign their Intranet site in just three days. This site design was developed behind the scenes to provide a template for Funko's department sites.
7 |
8 | 
9 |
10 | This demo shows how to:
11 |
12 | * Trigger a Microsoft Flow to call an Azure function to do things that aren't (yet?) supported by Site Designs; in this case, that includes placement of sections and web parts onto the home page, creation of an About page, and a customized view on the Site Pages library
13 | * Create and include a Theme
14 | * Deploy site designs and scripts using PowerShell to inject environment-specific values such as the tenant name, logo URL, etc.
15 |
16 | ## Sample
17 |
18 | Solution|Author(s)
19 | --------|---------
20 | site-azure-function | Bob German, Microsoft
21 |
22 | ## Version history
23 |
24 | Version|Date|Comments
25 | -------|----|--------
26 | 1.0|July 10, 2018|Initial release
27 |
28 | ## Disclaimer
29 | **THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
30 |
31 | ---
32 |
33 | ## Additional notes
34 | To install this sample, you'll need to provision:
35 |
36 | * a custom SharePoint Framework solution containing web parts
37 | * an Azure function containing the PnP PowerShell to add these web parts to the site home page
38 | * an Azure Queue to trigger the Azure Function when an item is added by a Flow
39 | * a Microsoft Flow that's started by the Site Script and queues the request
40 |
41 | Your needs may be simpler, and you may want to just refer to this to set up your scenario! Please take what you need and leave the rest.
42 |
43 | Here are the details.
44 |
45 | ## Set up the SharePoint Framework solution
46 |
47 | This solution uses the Hub Links List and Hub Box Button web parts from the [Links and Handlebars web parts](https://github.com/SharePoint/sp-dev-solutions/tree/master/solutions/LinksAndHandlebarsTemplate), which are placed on the home page. Follow the instructions in the readme to install them, and ensure that they're installed as "tenant scoped" so they can be used on all sites. The package is already set to allow this; just make sure that when you add the web parts to your app catalog you check the "Make this solution available to all sites in the organization" check box.
48 |
49 | 
50 |
51 | It's a good idea to test the web parts on a modern site before proceeding.
52 |
53 | ## Set up the Flow and Azure Function
54 |
55 | A major requirement in the SharePoint Swoop project was to add web parts and sections to each department site in a consistent way. Since (at the time of this writing) this isn't supported by site designs and scripts, the solution is to use the PnP Provisioning Engine to perform those functions.
56 |
57 | This solution is based on the documented process for [Calling the PnP Provisioning Engine from a site script](https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-pnp-provisioning). Follow the steps in the article, adding information from this repo as follows:
58 |
59 | * In the section, "Provision the SPFx solution", install the Links and Handlebars web parts instead of the ones in the article. (You may have already done that!)
60 | * You can skip the section, "Create a PnP Provisioning template" as the template information is already in the Azure function in this repo
61 | * In the section, "Finish the Azure Function", add the Azure Function code from this repo instead of the sample in the article. Make sure you set up the SPO_AppId and SPO_AppSecret application settings as explained in Step 4.
62 | * You can skip the section "Create the Site Design" for now, as this is handled by the Install-SampleSiteDesign.ps1 PowerShell script in this repo
63 |
64 | ## Install the SharePoint Theme
65 |
66 | This repo includes a PowerShell script,Install-SampleTheme.ps1, to create a custom site theme. You may want to make a new theme for your site, or you can stick with the Funko colors (which are close but not quite the same as the SharePoint colors).
67 |
68 | For example, if you want to call your theme DeptThemeSample, run this:
69 |
70 | .\Install-SampleTheme.ps1 `
71 | -Url https://-admin.sharepoint.com `
72 | -ThemeName "DeptThemeSample"
73 |
74 | ## Install the Site Design and Site Script
75 |
76 | The Install-SampleSiteDesign.ps1 script contains the site script JSON and the PowerShell to set it up. Notice that all tenant-specific settings are parameters to the script, and some of them are added to the site script at runtime.
77 |
78 | For example, you might call
79 |
80 | .\Install-SampleSiteDesign.ps1 `
81 | -Url https://-admin.sharepoint.com `
82 | -LogoUrl "https://www.somewhere.com/companyLogo.jpg" `
83 | -ThemeName "DeptThemeSample" `
84 | -FlowTriggerUrl "https://(URL from step 14 of the Site Design PnP Provisioning article)"
85 |
86 | Now you should be able to create a Communications Site from SharePoint Home and the site design should be displayed. The site script triggers the Flow, which adds to the Azure Queue, which calls the Azure Function to populate the site home page.
87 |
88 |
89 |
--------------------------------------------------------------------------------
/samples/site-designs-flow-azure-functions-pnp-hubsites/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # Azure Functions localsettings file
5 | local.settings.json
6 |
7 | # User-specific files
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Dd]ebugPublic/
19 | [Rr]elease/
20 | [Rr]eleases/
21 | x64/
22 | x86/
23 | bld/
24 | [Bb]in/
25 | [Oo]bj/
26 | [Ll]og/
27 |
28 | # Visual Studio 2015 cache/options directory
29 | .vs/
30 | # Uncomment if you have tasks that create the project's static files in wwwroot
31 | #wwwroot/
32 |
33 | # MSTest test Results
34 | [Tt]est[Rr]esult*/
35 | [Bb]uild[Ll]og.*
36 |
37 | # NUNIT
38 | *.VisualState.xml
39 | TestResult.xml
40 |
41 | # Build Results of an ATL Project
42 | [Dd]ebugPS/
43 | [Rr]eleasePS/
44 | dlldata.c
45 |
46 | # DNX
47 | project.lock.json
48 | project.fragment.lock.json
49 | artifacts/
50 |
51 | *_i.c
52 | *_p.c
53 | *_i.h
54 | *.ilk
55 | *.meta
56 | *.obj
57 | *.pch
58 | *.pdb
59 | *.pgc
60 | *.pgd
61 | *.rsp
62 | *.sbr
63 | *.tlb
64 | *.tli
65 | *.tlh
66 | *.tmp
67 | *.tmp_proj
68 | *.log
69 | *.vspscc
70 | *.vssscc
71 | .builds
72 | *.pidb
73 | *.svclog
74 | *.scc
75 |
76 | # Chutzpah Test files
77 | _Chutzpah*
78 |
79 | # Visual C++ cache files
80 | ipch/
81 | *.aps
82 | *.ncb
83 | *.opendb
84 | *.opensdf
85 | *.sdf
86 | *.cachefile
87 | *.VC.db
88 | *.VC.VC.opendb
89 |
90 | # Visual Studio profiler
91 | *.psess
92 | *.vsp
93 | *.vspx
94 | *.sap
95 |
96 | # TFS 2012 Local Workspace
97 | $tf/
98 |
99 | # Guidance Automation Toolkit
100 | *.gpState
101 |
102 | # ReSharper is a .NET coding add-in
103 | _ReSharper*/
104 | *.[Rr]e[Ss]harper
105 | *.DotSettings.user
106 |
107 | # JustCode is a .NET coding add-in
108 | .JustCode
109 |
110 | # TeamCity is a build add-in
111 | _TeamCity*
112 |
113 | # DotCover is a Code Coverage Tool
114 | *.dotCover
115 |
116 | # NCrunch
117 | _NCrunch_*
118 | .*crunch*.local.xml
119 | nCrunchTemp_*
120 |
121 | # MightyMoose
122 | *.mm.*
123 | AutoTest.Net/
124 |
125 | # Web workbench (sass)
126 | .sass-cache/
127 |
128 | # Installshield output folder
129 | [Ee]xpress/
130 |
131 | # DocProject is a documentation generator add-in
132 | DocProject/buildhelp/
133 | DocProject/Help/*.HxT
134 | DocProject/Help/*.HxC
135 | DocProject/Help/*.hhc
136 | DocProject/Help/*.hhk
137 | DocProject/Help/*.hhp
138 | DocProject/Help/Html2
139 | DocProject/Help/html
140 |
141 | # Click-Once directory
142 | publish/
143 |
144 | # Publish Web Output
145 | *.[Pp]ublish.xml
146 | *.azurePubxml
147 | # TODO: Comment the next line if you want to checkin your web deploy settings
148 | # but database connection strings (with potential passwords) will be unencrypted
149 | *.pubxml
150 | *.publishproj
151 |
152 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
153 | # checkin your Azure Web App publish settings, but sensitive information contained
154 | # in these scripts will be unencrypted
155 | PublishScripts/
156 |
157 | # NuGet Packages
158 | *.nupkg
159 | # The packages folder can be ignored because of Package Restore
160 | **/packages/*
161 | # except build/, which is used as an MSBuild target.
162 | !**/packages/build/
163 | # Uncomment if necessary however generally it will be regenerated when needed
164 | #!**/packages/repositories.config
165 | # NuGet v3's project.json files produces more ignoreable files
166 | *.nuget.props
167 | *.nuget.targets
168 |
169 | # Microsoft Azure Build Output
170 | csx/
171 | *.build.csdef
172 |
173 | # Microsoft Azure Emulator
174 | ecf/
175 | rcf/
176 |
177 | # Windows Store app package directories and files
178 | AppPackages/
179 | BundleArtifacts/
180 | Package.StoreAssociation.xml
181 | _pkginfo.txt
182 |
183 | # Visual Studio cache files
184 | # files ending in .cache can be ignored
185 | *.[Cc]ache
186 | # but keep track of directories ending in .cache
187 | !*.[Cc]ache/
188 |
189 | # Others
190 | ClientBin/
191 | ~$*
192 | *~
193 | *.dbmdl
194 | *.dbproj.schemaview
195 | *.jfm
196 | *.pfx
197 | *.publishsettings
198 | node_modules/
199 | orleans.codegen.cs
200 |
201 | # Since there are multiple workflows, uncomment next line to ignore bower_components
202 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
203 | #bower_components/
204 |
205 | # RIA/Silverlight projects
206 | Generated_Code/
207 |
208 | # Backup & report files from converting an old project file
209 | # to a newer Visual Studio version. Backup files are not needed,
210 | # because we have git ;-)
211 | _UpgradeReport_Files/
212 | Backup*/
213 | UpgradeLog*.XML
214 | UpgradeLog*.htm
215 |
216 | # SQL Server files
217 | *.mdf
218 | *.ldf
219 |
220 | # Business Intelligence projects
221 | *.rdl.data
222 | *.bim.layout
223 | *.bim_*.settings
224 |
225 | # Microsoft Fakes
226 | FakesAssemblies/
227 |
228 | # GhostDoc plugin setting file
229 | *.GhostDoc.xml
230 |
231 | # Node.js Tools for Visual Studio
232 | .ntvs_analysis.dat
233 |
234 | # Visual Studio 6 build log
235 | *.plg
236 |
237 | # Visual Studio 6 workspace options file
238 | *.opt
239 |
240 | # Visual Studio LightSwitch build output
241 | **/*.HTMLClient/GeneratedArtifacts
242 | **/*.DesktopClient/GeneratedArtifacts
243 | **/*.DesktopClient/ModelManifest.xml
244 | **/*.Server/GeneratedArtifacts
245 | **/*.Server/ModelManifest.xml
246 | _Pvt_Extensions
247 |
248 | # Paket dependency manager
249 | .paket/paket.exe
250 | paket-files/
251 |
252 | # FAKE - F# Make
253 | .fake/
254 |
255 | # JetBrains Rider
256 | .idea/
257 | *.sln.iml
258 |
259 | # CodeRush
260 | .cr/
261 |
262 | # Python Tools for Visual Studio (PTVS)
263 | __pycache__/
264 | *.pyc
--------------------------------------------------------------------------------
/samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.PnP/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # Azure Functions localsettings file
5 | local.settings.json
6 |
7 | # User-specific files
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Dd]ebugPublic/
19 | [Rr]elease/
20 | [Rr]eleases/
21 | x64/
22 | x86/
23 | bld/
24 | [Bb]in/
25 | [Oo]bj/
26 | [Ll]og/
27 |
28 | # Visual Studio 2015 cache/options directory
29 | .vs/
30 | # Uncomment if you have tasks that create the project's static files in wwwroot
31 | #wwwroot/
32 |
33 | # MSTest test Results
34 | [Tt]est[Rr]esult*/
35 | [Bb]uild[Ll]og.*
36 |
37 | # NUNIT
38 | *.VisualState.xml
39 | TestResult.xml
40 |
41 | # Build Results of an ATL Project
42 | [Dd]ebugPS/
43 | [Rr]eleasePS/
44 | dlldata.c
45 |
46 | # DNX
47 | project.lock.json
48 | project.fragment.lock.json
49 | artifacts/
50 |
51 | *_i.c
52 | *_p.c
53 | *_i.h
54 | *.ilk
55 | *.meta
56 | *.obj
57 | *.pch
58 | *.pdb
59 | *.pgc
60 | *.pgd
61 | *.rsp
62 | *.sbr
63 | *.tlb
64 | *.tli
65 | *.tlh
66 | *.tmp
67 | *.tmp_proj
68 | *.log
69 | *.vspscc
70 | *.vssscc
71 | .builds
72 | *.pidb
73 | *.svclog
74 | *.scc
75 |
76 | # Chutzpah Test files
77 | _Chutzpah*
78 |
79 | # Visual C++ cache files
80 | ipch/
81 | *.aps
82 | *.ncb
83 | *.opendb
84 | *.opensdf
85 | *.sdf
86 | *.cachefile
87 | *.VC.db
88 | *.VC.VC.opendb
89 |
90 | # Visual Studio profiler
91 | *.psess
92 | *.vsp
93 | *.vspx
94 | *.sap
95 |
96 | # TFS 2012 Local Workspace
97 | $tf/
98 |
99 | # Guidance Automation Toolkit
100 | *.gpState
101 |
102 | # ReSharper is a .NET coding add-in
103 | _ReSharper*/
104 | *.[Rr]e[Ss]harper
105 | *.DotSettings.user
106 |
107 | # JustCode is a .NET coding add-in
108 | .JustCode
109 |
110 | # TeamCity is a build add-in
111 | _TeamCity*
112 |
113 | # DotCover is a Code Coverage Tool
114 | *.dotCover
115 |
116 | # NCrunch
117 | _NCrunch_*
118 | .*crunch*.local.xml
119 | nCrunchTemp_*
120 |
121 | # MightyMoose
122 | *.mm.*
123 | AutoTest.Net/
124 |
125 | # Web workbench (sass)
126 | .sass-cache/
127 |
128 | # Installshield output folder
129 | [Ee]xpress/
130 |
131 | # DocProject is a documentation generator add-in
132 | DocProject/buildhelp/
133 | DocProject/Help/*.HxT
134 | DocProject/Help/*.HxC
135 | DocProject/Help/*.hhc
136 | DocProject/Help/*.hhk
137 | DocProject/Help/*.hhp
138 | DocProject/Help/Html2
139 | DocProject/Help/html
140 |
141 | # Click-Once directory
142 | publish/
143 |
144 | # Publish Web Output
145 | *.[Pp]ublish.xml
146 | *.azurePubxml
147 | # TODO: Comment the next line if you want to checkin your web deploy settings
148 | # but database connection strings (with potential passwords) will be unencrypted
149 | *.pubxml
150 | *.publishproj
151 |
152 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
153 | # checkin your Azure Web App publish settings, but sensitive information contained
154 | # in these scripts will be unencrypted
155 | PublishScripts/
156 |
157 | # NuGet Packages
158 | *.nupkg
159 | # The packages folder can be ignored because of Package Restore
160 | **/packages/*
161 | # except build/, which is used as an MSBuild target.
162 | !**/packages/build/
163 | # Uncomment if necessary however generally it will be regenerated when needed
164 | #!**/packages/repositories.config
165 | # NuGet v3's project.json files produces more ignoreable files
166 | *.nuget.props
167 | *.nuget.targets
168 |
169 | # Microsoft Azure Build Output
170 | csx/
171 | *.build.csdef
172 |
173 | # Microsoft Azure Emulator
174 | ecf/
175 | rcf/
176 |
177 | # Windows Store app package directories and files
178 | AppPackages/
179 | BundleArtifacts/
180 | Package.StoreAssociation.xml
181 | _pkginfo.txt
182 |
183 | # Visual Studio cache files
184 | # files ending in .cache can be ignored
185 | *.[Cc]ache
186 | # but keep track of directories ending in .cache
187 | !*.[Cc]ache/
188 |
189 | # Others
190 | ClientBin/
191 | ~$*
192 | *~
193 | *.dbmdl
194 | *.dbproj.schemaview
195 | *.jfm
196 | *.pfx
197 | *.publishsettings
198 | node_modules/
199 | orleans.codegen.cs
200 |
201 | # Since there are multiple workflows, uncomment next line to ignore bower_components
202 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
203 | #bower_components/
204 |
205 | # RIA/Silverlight projects
206 | Generated_Code/
207 |
208 | # Backup & report files from converting an old project file
209 | # to a newer Visual Studio version. Backup files are not needed,
210 | # because we have git ;-)
211 | _UpgradeReport_Files/
212 | Backup*/
213 | UpgradeLog*.XML
214 | UpgradeLog*.htm
215 |
216 | # SQL Server files
217 | *.mdf
218 | *.ldf
219 |
220 | # Business Intelligence projects
221 | *.rdl.data
222 | *.bim.layout
223 | *.bim_*.settings
224 |
225 | # Microsoft Fakes
226 | FakesAssemblies/
227 |
228 | # GhostDoc plugin setting file
229 | *.GhostDoc.xml
230 |
231 | # Node.js Tools for Visual Studio
232 | .ntvs_analysis.dat
233 |
234 | # Visual Studio 6 build log
235 | *.plg
236 |
237 | # Visual Studio 6 workspace options file
238 | *.opt
239 |
240 | # Visual Studio LightSwitch build output
241 | **/*.HTMLClient/GeneratedArtifacts
242 | **/*.DesktopClient/GeneratedArtifacts
243 | **/*.DesktopClient/ModelManifest.xml
244 | **/*.Server/GeneratedArtifacts
245 | **/*.Server/ModelManifest.xml
246 | _Pvt_Extensions
247 |
248 | # Paket dependency manager
249 | .paket/paket.exe
250 | paket-files/
251 |
252 | # FAKE - F# Make
253 | .fake/
254 |
255 | # JetBrains Rider
256 | .idea/
257 | *.sln.iml
258 |
259 | # CodeRush
260 | .cr/
261 |
262 | # Python Tools for Visual Studio (PTVS)
263 | __pycache__/
264 | *.pyc
--------------------------------------------------------------------------------
/samples/site-apply-column-and-row-formatting/site-script-column-row-formatting-on-list.json:
--------------------------------------------------------------------------------
1 | {
2 | "actions": [
3 |
4 | {
5 | "verb": "createSiteColumnXml",
6 | "schemaXml": "In ProgressIn ProgressIn ReviewDoneHas Issues"
7 | },
8 | {
9 | "verb": "createSiteColumnXml",
10 | "schemaXml": "OperationsOperationsITLegalEngineeringHRServicesConsulting"
11 | },
12 | {
13 | "verb": "createContentType",
14 | "name": "ContosoProjects",
15 | "id": "0x0100B609FEFDEFAA484299C6DE254182E666",
16 | "description": "custom list content type",
17 | "parentId": "0x01",
18 | "hidden": false,
19 | "subactions": [
20 | {
21 | "verb": "addSiteColumn",
22 | "internalName": "ProjectStatus"
23 | },
24 | {
25 | "verb": "addSiteColumn",
26 | "internalName": "ProjectCategory"
27 | }
28 | ]
29 | },
30 | {
31 | "verb": "createSPList",
32 | "listName": "Project Tracker",
33 | "templateType": 100,
34 | "subactions": [
35 | {
36 | "verb": "addContentType",
37 | "name": "ContosoProjects"
38 | },
39 | {
40 | "verb": "addSPFieldXml",
41 | "schemaXml": ""
42 | },
43 | {
44 | "verb": "setSPFieldCustomFormatter",
45 | "fieldDisplayName": "Project Status",
46 | "formatterJSON": {
47 | "$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json",
48 | "elmType": "div",
49 | "attributes": {
50 | "class": {
51 | "operator": "?",
52 | "operands": [
53 | {
54 | "operator": "==",
55 | "operands": [
56 | "@currentField",
57 | "Done"
58 | ]
59 | },
60 | "sp-field-severity--good",
61 | {
62 | "operator": "?",
63 | "operands": [
64 | {
65 | "operator": "==",
66 | "operands": [
67 | "@currentField",
68 | "In progress"
69 | ]
70 | },
71 | "sp-field-severity--low",
72 | {
73 | "operator": "?",
74 | "operands": [
75 | {
76 | "operator": "==",
77 | "operands": [
78 | "@currentField",
79 | "In review"
80 | ]
81 | },
82 | "sp-field-severity--warning",
83 | {
84 | "operator": "?",
85 | "operands": [
86 | {
87 | "operator": "==",
88 | "operands": [
89 | "@currentField",
90 | "Has issues"
91 | ]
92 | },
93 | "sp-field-severity--severeWarning",
94 | "sp-field-severity--blocked"
95 | ]
96 | }
97 | ]
98 | }
99 | ]
100 | }
101 | ]
102 | }
103 | },
104 | "children": [
105 | {
106 | "elmType": "span",
107 | "style": {
108 | "display": "inline-block",
109 | "padding-left": "4px"
110 | },
111 | "attributes": {
112 | "iconName": {
113 | "operator": "?",
114 | "operands": [
115 | {
116 | "operator": "==",
117 | "operands": [
118 | "@currentField",
119 | "Done"
120 | ]
121 | },
122 | "CheckMark",
123 | {
124 | "operator": "?",
125 | "operands": [
126 | {
127 | "operator": "==",
128 | "operands": [
129 | "@currentField",
130 | "In progress"
131 | ]
132 | },
133 | "Forward",
134 | {
135 | "operator": "?",
136 | "operands": [
137 | {
138 | "operator": "==",
139 | "operands": [
140 | "@currentField",
141 | "In review"
142 | ]
143 | },
144 | "Error",
145 | {
146 | "operator": "?",
147 | "operands": [
148 | {
149 | "operator": "==",
150 | "operands": [
151 | "@currentField",
152 | "Has issues"
153 | ]
154 | },
155 | "Warning",
156 | "ErrorBadge"
157 | ]
158 | }
159 | ]
160 | }
161 | ]
162 | }
163 | ]
164 | }
165 | }
166 | },
167 | {
168 | "elmType": "span",
169 | "txtContent": "@currentField",
170 | "style": {
171 | "padding-left": "4px"
172 | }
173 | }
174 | ]
175 | }
176 | },
177 | {
178 | "verb": "addSPView",
179 | "name": "All Items",
180 | "viewFields": [
181 | "LinkTitle",
182 | "ProjectProgress",
183 | "ProjectStatus",
184 | "ProjectCategory"
185 | ],
186 | "query": "",
187 | "rowLimit": 30,
188 | "isPaged": true,
189 | "makeDefault": true,
190 | "formatterJSON": {"additionalRowClass": "=if([$ProjectCategory] == 'Legal', 'sp-field-severity--blocked', '' )"}
191 | }
192 | ]
193 | },
194 | {
195 | "verb": "addNavLink",
196 | "url": "Lists/Project Tracker/AllItems.aspx",
197 | "displayName": "My Projects",
198 | "isWebRelative": true
199 | }
200 | ]
201 | }
--------------------------------------------------------------------------------
/samples/site-create-lookup-lists-spfieldxml/site-script-add-spfieldxml-with-lookup.json:
--------------------------------------------------------------------------------
1 | {
2 | "actions": [
3 | {
4 | "verb": "createSiteColumnXml",
5 | "schemaXml": "In ProgressIn ProgressIn ReviewDoneHas Issues"
6 | },
7 | {
8 | "verb": "createSiteColumnXml",
9 | "schemaXml": "OperationsOperationsITLegalEngineeringHRServicesConsulting"
10 | },
11 | {
12 | "verb": "createContentType",
13 | "name": "ContosoProjects",
14 | "id": "0x0100B609FEFDEFAA484299C6DE254182E666",
15 | "description": "custom list content type",
16 | "parentId": "0x01",
17 | "hidden": false,
18 | "subactions": [
19 | {
20 | "verb": "addSiteColumn",
21 | "internalName": "ProjectStatus"
22 | },
23 | {
24 | "verb": "addSiteColumn",
25 | "internalName": "ProjectCategory"
26 | }
27 | ]
28 | },
29 | {
30 | "verb": "createSPList",
31 | "listName": "Contoso Project List",
32 | "templateType": 100,
33 | "subactions": [
34 | {
35 | "verb": "addContentType",
36 | "name": "ContosoProjects"
37 | },
38 | {
39 | "verb": "addSPFieldXml",
40 | "schemaXml": ""
41 | },
42 | {
43 | "verb": "addSPFieldXml",
44 | "schemaXml": ""
45 | },
46 | {
47 | "verb": "addSPView",
48 | "name": "All Items",
49 | "viewFields": [
50 | "LinkTitle",
51 | "MyFieldA1"
52 | ],
53 | "query": "",
54 | "rowLimit": 30,
55 | "isPaged": true,
56 | "makeDefault": true
57 | }
58 | ]
59 | },
60 | {
61 | "verb": "createSPList",
62 | "listName": "Project Tracker List",
63 | "templateType": 100,
64 | "subactions": [
65 | {
66 | "verb": "addSPFieldXml",
67 | "schemaXml": ""
68 | },
69 | {
70 | "verb": "addSPFieldXml",
71 | "schemaXml": "Enter Choice #1Enter Choice #1Enter Choice #2Enter Choice #3"
72 | },
73 | {
74 | "verb": "addSPFieldXml",
75 | "schemaXml": "Enter Choice #1Enter Choice #1Enter Choice #2Enter Choice #3"
76 | },
77 | {
78 | "verb": "addSPFieldXml",
79 | "schemaXml": "Enter Choice #1Enter Choice #1Enter Choice #2Enter Choice #3"
80 | },
81 | {
82 | "verb": "addSPFieldXml",
83 | "schemaXml": ""
84 | },
85 | {
86 | "verb": "addSPFieldXml",
87 | "schemaXml": ""
88 | },
89 | {
90 | "verb": "addSPFieldXml",
91 | "schemaXml": "1"
92 | },
93 | {
94 | "verb": "addSPFieldXml",
95 | "schemaXml": ""
96 | },
97 | {
98 | "verb": "addSPFieldXml",
99 | "schemaXml": ""
100 | },
101 | {
102 | "verb": "addSPLookupFieldXml",
103 | "schemaXml": "",
104 | "targetListName": "Contoso Project List"
105 | },
106 | {
107 | "verb": "addSPLookupFieldXml",
108 | "schemaXml": "",
109 | "targetListName": "Contoso Project List"
110 | },
111 | {
112 | "verb": "addSPLookupFieldXml",
113 | "schemaXml": "",
114 | "targetListName": "Contoso Project List"
115 | },
116 | {
117 | "verb": "addSPView",
118 | "name": "All Items",
119 | "viewFields": [
120 | "LinkTitle",
121 | "MyNumber",
122 | "MyChoice1",
123 | "MyChoice2",
124 | "MyChoice3",
125 | "MyCurrency",
126 | "MyDateTime",
127 | "MyCheckBox",
128 | "MyLinkURL",
129 | "MyLinkPicture",
130 | "Lookup",
131 | "MyLookup1",
132 | "MyLookup2"
133 | ],
134 | "query": "",
135 | "rowLimit": 30,
136 | "isPaged": true,
137 | "makeDefault": true
138 | }
139 | ]
140 | }
141 | ]
142 | }
--------------------------------------------------------------------------------
/samples/site-create-formatted-lists/create-formatted-lists.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "schema.json",
3 | "actions":
4 | [
5 | {
6 | "verb": "createSPList",
7 | "templateType": 100,
8 | "listName": "Project Activities",
9 | "subactions": [
10 | {
11 | "verb": "setDescription",
12 | "description": "List of project activities"
13 | },
14 | {
15 | "verb": "addSPField",
16 | "fieldType": "Text",
17 | "displayName": "Project Status",
18 | "isRequired": true,
19 | "addToDefaultView": true
20 | },
21 | {
22 | "verb": "addSPField",
23 | "fieldType": "Number",
24 | "displayName": "Effort (days)",
25 | "addToDefaultView": true,
26 | "isRequired": true
27 | },
28 | {
29 | "verb": "addSPField",
30 | "fieldType": "Note",
31 | "displayName": "Meeting Notes",
32 | "addToDefaultView": true,
33 | "isRequired": false
34 | },
35 | {
36 | "verb": "addSPField",
37 | "fieldType": "User",
38 | "displayName": "Assigned To",
39 | "addToDefaultView": true,
40 | "isRequired": true
41 | },
42 | {
43 | "verb": "setSPFieldCustomFormatter",
44 | "fieldDisplayName": "Project Status",
45 | "formatterJSON": {
46 | "$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json",
47 | "debugMode": true,
48 | "elmType": "div",
49 | "attributes": {
50 | "class": {
51 | "operator": "?",
52 | "operands": [
53 | {
54 | "operator": "==",
55 | "operands": [
56 | {
57 | "operator": "toString()",
58 | "operands": [
59 | "@currentField"
60 | ]
61 | },
62 | "Done"
63 | ]
64 | },
65 | "sp-field-severity--good",
66 | {
67 | "operator": "?",
68 | "operands": [
69 | {
70 | "operator": "==",
71 | "operands": [
72 | {
73 | "operator": "toString()",
74 | "operands": [
75 | "@currentField"
76 | ]
77 | },
78 | "In progress"
79 | ]
80 | },
81 | "sp-field-severity--low",
82 | {
83 | "operator": "?",
84 | "operands": [
85 | {
86 | "operator": "==",
87 | "operands": [
88 | {
89 | "operator": "toString()",
90 | "operands": [
91 | "@currentField"
92 | ]
93 | },
94 | "In review"
95 | ]
96 | },
97 | "sp-field-severity--warning",
98 | {
99 | "operator": "?",
100 | "operands": [
101 | {
102 | "operator": "==",
103 | "operands": [
104 | {
105 | "operator": "toString()",
106 | "operands": [
107 | "@currentField"
108 | ]
109 | },
110 | "Blocked"
111 | ]
112 | },
113 | "sp-field-severity--severeWarning",
114 | "sp-field-severity--blocked"
115 | ]
116 | }
117 | ]
118 | }
119 | ]
120 | }
121 | ]
122 | }
123 | },
124 | "children": [
125 | {
126 | "elmType": "span",
127 | "style": {
128 | "display": "inline-block",
129 | "padding": "0 4px"
130 | },
131 | "attributes": {
132 | "iconName": {
133 | "operator": "?",
134 | "operands": [
135 | {
136 | "operator": "==",
137 | "operands": [
138 | {
139 | "operator": "toString()",
140 | "operands": [
141 | "@currentField"
142 | ]
143 | },
144 | "Done"
145 | ]
146 | },
147 | "CheckMark",
148 | {
149 | "operator": "?",
150 | "operands": [
151 | {
152 | "operator": "==",
153 | "operands": [
154 | {
155 | "operator": "toString()",
156 | "operands": [
157 | "@currentField"
158 | ]
159 | },
160 | "In progress"
161 | ]
162 | },
163 | "Forward",
164 | {
165 | "operator": "?",
166 | "operands": [
167 | {
168 | "operator": "==",
169 | "operands": [
170 | {
171 | "operator": "toString()",
172 | "operands": [
173 | "@currentField"
174 | ]
175 | },
176 | "In review"
177 | ]
178 | },
179 | "Error",
180 | {
181 | "operator": "?",
182 | "operands": [
183 | {
184 | "operator": "==",
185 | "operands": [
186 | {
187 | "operator": "toString()",
188 | "operands": [
189 | "@currentField"
190 | ]
191 | },
192 | "Has issues"
193 | ]
194 | },
195 | "Warning",
196 | "ErrorBadge"
197 | ]
198 | }
199 | ]
200 | }
201 | ]
202 | }
203 | ]
204 | }
205 | }
206 | },
207 | {
208 | "elmType": "span",
209 | "txtContent": "@currentField"
210 | }
211 | ]
212 | }
213 | },
214 | {
215 | "verb": "setSPFieldCustomFormatter",
216 | "fieldDisplayName": "Assigned To",
217 | "formatterJSON":
218 | {
219 | "elmType": "div",
220 | "children":
221 | [
222 | {
223 | "elmType": "span",
224 | "style": {
225 | "padding-right": "8px"
226 | },
227 | "txtContent": "@currentField.title"
228 | },
229 | {
230 | "elmType": "a",
231 | "attributes":
232 | {
233 | "iconName": "Mail",
234 | "class": "sp-field-quickActions",
235 | "href":
236 | {
237 | "operator": "+",
238 | "operands":
239 | [
240 | "mailto:",
241 | "@currentField.email",
242 | "?subject=Task status&body=Hey, how is your task coming along?.\r\n---\r\n",
243 | "@currentField.title",
244 | "\r\nUpdate Status"
245 | ]
246 | }
247 | }
248 | }
249 | ]
250 | }
251 | },
252 | {
253 | "verb": "setSPFieldCustomFormatter",
254 | "fieldDisplayName": "Effort (days)",
255 | "formatterJSON":
256 | {
257 | "debugMode": true,
258 | "elmType": "div",
259 | "txtContent": "@currentField",
260 | "attributes": {
261 | "class": "sp-field-dataBars"
262 | },
263 | "style": {
264 | "width": {
265 | "operator": "?",
266 | "operands": [
267 | {
268 | "operator": ">",
269 | "operands": [
270 | "@currentField",
271 | "20"
272 | ]
273 | },
274 | "100%",
275 | {
276 | "operator": "+",
277 | "operands": [
278 | {
279 | "operator": "toString()",
280 | "operands": [
281 | {
282 | "operator": "*",
283 | "operands": [
284 | "@currentField",
285 | 5
286 | ]
287 | }
288 | ]
289 | },
290 | "%"
291 | ]
292 | }
293 | ]
294 | }
295 | }
296 | }
297 | }
298 | ]
299 | },
300 | {
301 | "verb": "createSPList",
302 | "templateType": 101,
303 | "listName": "Project Collateral",
304 | "subactions": [
305 | {
306 | "verb": "setDescription",
307 | "description": "A library of project-specific files"
308 | },
309 | {
310 | "verb": "addSPField",
311 | "fieldType": "DateTime",
312 | "displayName": "Due Date",
313 | "addToDefaultView": true,
314 | "isRequired": true
315 | },
316 | {
317 | "verb": "addSPField",
318 | "fieldType": "User",
319 | "displayName": "Contact",
320 | "addToDefaultView": true,
321 | "isRequired": true
322 | },
323 |
324 | {
325 | "verb": "setSPFieldCustomFormatter",
326 | "fieldDisplayName": "Due Date",
327 | "formatterJSON": {
328 |
329 | "elmType": "div",
330 | "txtContent": "@currentField",
331 | "style": {
332 | "color": {
333 | "operator": "?",
334 | "operands": [
335 | {
336 | "operator": "<=",
337 | "operands": [
338 | "[$DueDate]",
339 | "@now"
340 | ]
341 | },
342 | "#ff0000",
343 | ""
344 | ]
345 | }
346 | }
347 | }
348 | }
349 |
350 | ]
351 | },
352 | {
353 | "verb": "addNavLink",
354 | "url": "/Project Collateral",
355 | "displayName": "Project Collateral",
356 | "isWebRelative": true
357 | },
358 | {
359 | "verb": "addNavLink",
360 | "url": "/Lists/Project Activities",
361 | "displayName": "Project Activities",
362 | "isWebRelative": true
363 | }
364 | ],
365 | "bindata":
366 | {
367 | },
368 | "version": 1
369 | }
370 |
--------------------------------------------------------------------------------