├── .github ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── LICENSE ├── README.md └── samples ├── README-template.md ├── install-spfx-solution ├── README.md ├── install-appcat-solution.json ├── screenshot-appcat-solutionid.png ├── screenshot-appcat-spfx-solution-enabled.png ├── screenshot-install-spfx-solution-script-action.png └── screenshot-solution-applied.png ├── readme.md ├── site-apply-column-and-row-formatting ├── README.md ├── outcome.png ├── readme.txt ├── screenshot.png └── site-script-column-row-formatting-on-list.json ├── site-apply-company-theme-by-themeJson ├── README.md ├── applyCompanyThemeByThemeJson.json └── screenshot.png ├── site-apply-company-theme ├── README.md ├── applyCompanyTheme.json └── screenshot.png ├── site-apply-external-sharing-setting ├── README.md ├── apply-external-sharing-capability.json └── screenshot-site-external-sharing-script-action.png ├── site-apply-join-hubsite ├── README.md ├── applyJoinHubSite.json └── screenshot.png ├── site-apply-principal-to-spgroup ├── README.md ├── apply-principal-to-spgroup.json ├── readme.txt └── screenshot.png ├── site-apply-regional-settings ├── README.md ├── apply-regional-settings.json ├── screenshot-regionalsettings_updated.png └── screenshot-script_action_setregionalsettings.png ├── site-azure-function ├── Install-SampleSiteDesign.ps1 ├── Install-SampleTheme.ps1 ├── README.md ├── Remove-SampleSiteDesign.ps1 ├── Remove-SampleTheme.ps1 ├── SampleDeptSite.png ├── SetupDepartmentSite │ └── run.ps1 └── tenant-deploy-app-catalog.png ├── site-config-add-dynamic-navlinks-to-Office-365-groups ├── README.md ├── add-dynamic-references-to-default-components-of-an-Office-365-group.json ├── outcome.png └── screenshot.png ├── site-config-remove-navlinks ├── README.md ├── remove-default-team-template-links.json └── screenshot.png ├── site-create-advanced-lists ├── README.md ├── advanced_list_configuration.json ├── screenshot-custom_library_view_by_site_script.png └── screenshot-site_script_advanced_library_configuration_progress_panel.png ├── site-create-advanced-lists2 ├── README.md ├── list-configured-sitecolumn-fieldxml.json ├── screenshot-custom-list-illustrating-script-configured-view.png └── screenshot-list-configuration-progress-panel.png ├── site-create-formatted-lists ├── README.md ├── create-formatted-lists.json └── screenshot.png ├── site-create-lists-add-to-site-nav ├── README.md ├── create-list-add-links-to-sitenav.json └── screenshot.png ├── site-create-lookup-lists-spfieldxml ├── README.md ├── list_multi_lookup_field.png ├── screenshot.png └── site-script-add-spfieldxml-with-lookup.json ├── site-designs-flow-azure-functions-pnp-hubsites ├── .gitignore ├── .yo-rc.json ├── Office365.SiteDesigns.Deployment │ ├── Deploy.ps1 │ ├── Office365.SiteDesigns.Deployment.pssproj │ ├── SiteScripts │ │ ├── site-script-externalSharing.json │ │ ├── site-script-joinToHub.json │ │ ├── site-script-lists.json │ │ ├── site-script-spfxComponents.json │ │ ├── site-script-theme.json │ │ └── site-script-triggerFlow.json │ └── Utilities │ │ ├── ApplyModernTheme.ps1 │ │ ├── ApplySiteDesign.ps1 │ │ ├── ConfigureHubSite.ps1 │ │ └── CreateAzureResourceGroup.ps1 ├── Office365.SiteDesigns.PnP.sln ├── Office365.SiteDesigns.PnP │ ├── .gitignore │ ├── ApplyPnPTemplate.cs │ ├── Office365.SiteDesigns.PnP.csproj │ ├── PnPSiteSchemas │ │ └── SiteCollectionSchema.xml │ └── host.json ├── Office365.SiteDesigns.SPFx │ ├── .editorconfig │ ├── .gitignore │ ├── .vscode │ │ ├── extensions.json │ │ ├── launch.json │ │ └── settings.json │ ├── .yo-rc.json │ ├── README.md │ ├── config │ │ ├── config.json │ │ ├── copy-assets.json │ │ ├── deploy-azure-storage.json │ │ ├── package-solution.json │ │ ├── serve.json │ │ ├── tslint.json │ │ └── write-manifests.json │ ├── gulpfile.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── extensions │ │ │ └── footer │ │ │ │ ├── FooterApplicationCustomizer.manifest.json │ │ │ │ ├── FooterApplicationCustomizer.module.scss │ │ │ │ ├── FooterApplicationCustomizer.ts │ │ │ │ └── loc │ │ │ │ ├── en-us.js │ │ │ │ └── myStrings.d.ts │ │ └── webparts │ │ │ └── helloWorld │ │ │ ├── HelloWorldWebPart.manifest.json │ │ │ ├── HelloWorldWebPart.module.scss │ │ │ ├── HelloWorldWebPart.ts │ │ │ └── loc │ │ │ ├── en-us.js │ │ │ └── mystrings.d.ts │ └── tsconfig.json └── README.md ├── site-register-spfx-extension ├── README.md ├── readme.txt ├── register_extension.json └── screenshot.png └── triggerFlow-write-back-site-properties-to-splist ├── README.md ├── request-body-json-schema.json └── updated_triggerFlow_properties.png /.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. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Thank you for reporting an issue or suggesting an enhancement. We appreciate your feedback - to help the team to understand your needs, please complete the below template to ensure we have the necessary details to assist you. 2 | 3 | #### Category 4 | - [ ] Question 5 | - [ ] Bug 6 | - [ ] Enhancement 7 | 8 | #### Expected or Desired Behavior 9 | _If you are reporting a bug, please describe the expected behavior. If you are suggesting an enhancement please describe thoroughly the enhancement, how it can be achieved, and expected benefit._ 10 | 11 | #### Observed Behavior 12 | _If you are reporting a bug, please describe the behavior you expected to occur when performing the action. If you are making a suggestion, you can delete this section._ 13 | 14 | #### Steps to Reproduce 15 | _If you are reporting a bug please describe the steps to reproduce the bug in sufficient detail to allow testing. Only way to fix things properly, is to have sufficient details to reproduce it. If you are making a suggestion, you can delete this section._ 16 | 17 | #### Submission Guidelines 18 | _Delete this section after reading_ 19 | - All suggestions or bugs are welcome, please let us know what's on your mind. 20 | - If you are reporting an issue around any of the samples, please ensure that you have clear reference on the sample and possibly code file, which should be fixed. 21 | - Remember to include sufficient details and context. 22 | - If you have multiple suggestions or bugs please submit them in separate bugs so we can track resolution. 23 | 24 | Thanks for your contribution! Sharing is caring. 25 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | | Q | A 2 | | --------------- | --- 3 | | Bug fix? | no - yes? 4 | | New sample? | no - yes? 5 | | Related issues? | fixes #X, partially #Y, mentioned in #Z 6 | 7 | #### What's in this Pull Request? 8 | 9 | Please describe the changes in this PR. Sample description or details around bugs which are being fixed. 10 | 11 | 12 | #### Guidance 13 | *You can delete this section when you are submitting the pull request.* 14 | * *Please update this PR information accordingly. We'll use this as part of our release notes in monthly communications.* 15 | * *Please target your PR to 'master' branch.* 16 | 17 | Thanks for your contribution! Sharing is caring. -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # Typescript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | --- 2 | page_type: sample 3 | products: 4 | - office-sp 5 | languages: 6 | - json 7 | extensions: 8 | contentType: samples 9 | createdDate: 12/12/2017 7:56:02 AM 10 | --- 11 | # SharePoint Site Script samples 12 | 13 | You can use Site Scripts to customize how SharePoint sites are being provisioned. To do this, you construct a JSON object that describes the action to be applied when site is provisioned. You can also start external flow for the additional actions, if needed. 14 | 15 | This is a open source repository to share different kind of Site Scripts between community. Check [**Samples**](./samples) folder for what's currently available. Have you build one which you can share? - **We do welcome contributions**. 16 | 17 | ![Pic of site design panel in the site](https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/images/progress-pane.png) 18 | 19 | You can find more details around the Site Script and Site Design capability from official SharePoint Dev documentation. 20 | 21 | - [SharePoint site design and site script overview](https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-overview) 22 | 23 | # Contributing 24 | 25 | This project welcomes contributions and suggestions. Most contributions require you to agree to a 26 | Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us 27 | the rights to use your contribution. For details, visit https://cla.microsoft.com. 28 | 29 | When you submit a pull request, a CLA-bot will automatically determine whether you need to provide 30 | a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions 31 | provided by the bot. You will only need to do this once across all repos using our CLA. 32 | 33 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 34 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or 35 | contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 36 | -------------------------------------------------------------------------------- /samples/README-template.md: -------------------------------------------------------------------------------- 1 | # title of the sample 2 | 3 | ## Summary 4 | Short summary on functionality and used technologies. 5 | 6 | [picture of the provisioned site] 7 | 8 | ## Sample 9 | 10 | Solution|Author(s) 11 | --------|--------- 12 | folder-name | Author name and company details 13 | 14 | ## Version history 15 | 16 | Version|Date|Comments 17 | -------|----|-------- 18 | 1.0|August 29, 2025|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 | Any potential additional notes to get included in the readme around the sample with additional pictures etc. 27 | 28 | - topic 1 29 | - topic 2 30 | - topic 3 31 | 32 | -------------------------------------------------------------------------------- /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 | ![solution enabled](screenshot-appcat-spfx-solution-enabled.png) 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 | ![solution enabled](screenshot-appcat-solutionid.png) 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 | ![Screenshot](screenshot-install-spfx-solution-script-action.png) 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 | ![SPFx solution in action](screenshot-solution-applied.png) 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/install-spfx-solution/install-appcat-solution.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "schema.json", 3 | "actions": [ 4 | { 5 | "verb": "installSolution", 6 | "id": "d40e4edc-a6da-4cd8-b82d-bba970976809" 7 | } 8 | ], 9 | "bindata": { }, 10 | "version": 1 11 | } 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /samples/install-spfx-solution/screenshot-appcat-solutionid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/install-spfx-solution/screenshot-appcat-solutionid.png -------------------------------------------------------------------------------- /samples/install-spfx-solution/screenshot-appcat-spfx-solution-enabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/install-spfx-solution/screenshot-appcat-spfx-solution-enabled.png -------------------------------------------------------------------------------- /samples/install-spfx-solution/screenshot-install-spfx-solution-script-action.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/install-spfx-solution/screenshot-install-spfx-solution-script-action.png -------------------------------------------------------------------------------- /samples/install-spfx-solution/screenshot-solution-applied.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/install-spfx-solution/screenshot-solution-applied.png -------------------------------------------------------------------------------- /samples/readme.md: -------------------------------------------------------------------------------- 1 | # SharePoint Site Script samples 2 | 3 | Samples for the SharePoint Site Script feature to demonstrate different capabilities and possibilities. 4 | 5 | Each sample has its own dedicated readme file with a screenshot to show the result of the sample applied to a SharePoint site. 6 | -------------------------------------------------------------------------------- /samples/site-apply-column-and-row-formatting/README.md: -------------------------------------------------------------------------------- 1 | # Apply Custom Column and View formatting to a list 2 | 3 | ## Summary 4 | 5 | In this example we illustrate how you can apply custom column and a view formatting to a list. Column formatting is being applied to the "Project Status" field, with conditional iconography and color being applied to the field based on the value. Similarly, row formatting has been applied to the default "All Items" view to format the row background (using the predefined 'sp-field-severity--blocked' class) if the list item is identified with the "Legal" project category. 6 | 7 | For more details on the syntax check out: Use column formatting to customize SharePoint (https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting). 8 | 9 | ![Screenshot](screenshot.png) 10 | 11 | Here's how the list will look after script has been applied. 12 | 13 | ![Screenshot](outcome.png) 14 | 15 | ## Sample 16 | 17 | Solution|Author(s) 18 | --------|--------- 19 | site-apply-column-and-row-formatting | Sean Squires 20 | 21 | ## Version history 22 | 23 | Version|Date|Comments 24 | -------|----|-------- 25 | 1.0| August 7, 2018 |Initial release 26 | 27 | ## Disclaimer 28 | **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.** 29 | 30 | --- 31 | 32 | -------------------------------------------------------------------------------- /samples/site-apply-column-and-row-formatting/outcome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-apply-column-and-row-formatting/outcome.png -------------------------------------------------------------------------------- /samples/site-apply-column-and-row-formatting/readme.txt: -------------------------------------------------------------------------------- 1 | In this example we illustrate how you can apply custom column and row formatting to a list. Column formatting is being applied to the "Project Status" field, with conditional iconography and color being applied to the field based on the value. Similarly, row formatting has been applied to the default "All Items" view to format the row background (using the predefined 'sp-field-severity--blocked' class) if the list item is identified with the "Legal" project category. 2 | 3 | For more details on the syntax check out: Use column formatting to customize SharePoint (https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting). 4 | 5 | -------------------------------------------------------------------------------- /samples/site-apply-column-and-row-formatting/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-apply-column-and-row-formatting/screenshot.png -------------------------------------------------------------------------------- /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-apply-company-theme-by-themeJson/README.md: -------------------------------------------------------------------------------- 1 | # Applying custom theme 2 | 3 | ## Summary 4 | 5 | Site script supports applying a custom theme to a site collection by either referencing the theme name or the JSON definition of the theme. The latter is done by the themeJson property. Rather than installing the custom theme to the tenant theme gallery, this property installs the custom theme only to the site collection. 6 | 7 | Check out the theme generator at https://aka.ms/spthemebuilder if you need help creating a custom theme. 8 | 9 | ![Screenshot](screenshot.png) 10 | 11 | > Note that the apply message doesn't contain the theme name. 12 | 13 | ## Sample 14 | 15 | Solution|Author(s) 16 | --------|--------- 17 | site-apply-company-theme-by-themeJson | Jarbas Horst 18 | 19 | ## Version history 20 | 21 | Version|Date|Comments 22 | -------|----|-------- 23 | 1.0|November 20, 2019|Initial release 24 | 25 | ## Disclaimer 26 | **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.** 27 | 28 | --- -------------------------------------------------------------------------------- /samples/site-apply-company-theme-by-themeJson/applyCompanyThemeByThemeJson.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "schema.json", 3 | "actions": [ 4 | { 5 | "verb": "applyTheme", 6 | "themeJson": { 7 | "version": 1, 8 | "isInverted": false, 9 | "palette": { 10 | "themePrimary": "#0078d4", 11 | "themeLighterAlt": "#eff6fc", 12 | "themeLighter": "#deecf9", 13 | "themeLight": "#c7e0f4", 14 | "themeTertiary": "#71afe5", 15 | "themeSecondary": "#2b88d8", 16 | "themeDarkAlt": "#106ebe", 17 | "themeDark": "#005a9e", 18 | "themeDarker": "#004578", 19 | "neutralLighterAlt": "#f8f8f8", 20 | "neutralLighter": "#f4f4f4", 21 | "neutralLight": "#eaeaea", 22 | "neutralQuaternaryAlt": "#dadada", 23 | "neutralQuaternary": "#d0d0d0", 24 | "neutralTertiaryAlt": "#c8c8c8", 25 | "neutralTertiary": "#c2c2c2", 26 | "neutralSecondary": "#858585", 27 | "neutralPrimaryAlt": "#4b4b4b", 28 | "neutralPrimary": "#333", 29 | "neutralDark": "#272727", 30 | "black": "#1d1d1d", 31 | "white": "#fff", 32 | "primaryBackground": "#fff", 33 | "primaryText": "#333", 34 | "bodyBackground": "#fff", 35 | "bodyText": "#333", 36 | "disabledBackground": "#f4f4f4", 37 | "disabledText": "#c8c8c8" 38 | } 39 | } 40 | } 41 | ], 42 | "bindata": { }, 43 | "version": 1 44 | } -------------------------------------------------------------------------------- /samples/site-apply-company-theme-by-themeJson/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-apply-company-theme-by-themeJson/screenshot.png -------------------------------------------------------------------------------- /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 | ![Screenshot](screenshot.png) 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-apply-company-theme/applyCompanyTheme.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "schema.json", 3 | "actions": [ 4 | { 5 | "verb": "applyTheme", 6 | "themeName": "My Company Theme" 7 | } 8 | ], 9 | "bindata": { }, 10 | "version": 1 11 | } 12 | -------------------------------------------------------------------------------- /samples/site-apply-company-theme/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-apply-company-theme/screenshot.png -------------------------------------------------------------------------------- /samples/site-apply-external-sharing-setting/README.md: -------------------------------------------------------------------------------- 1 | # Configure external sharing setting 2 | 3 | ## Summary 4 | 5 | You can use the `setSiteExternalSharingCapability` action to configure the external sharing settings of the site. 6 | 7 | For more details on this setting see: https://support.office.com/en-us/article/manage-external-sharing-for-your-sharepoint-online-environment-c8a462eb-0723-4b0b-8d0a-70feafe4be85 8 | 9 | ![External sharing applied in panel](screenshot-site-external-sharing-script-action.png) 10 | 11 | This sample illustrates using the setSiteExternalSharingCapability action to restrict sharing of content to only external users who are already in your Office 365 user directory. For example, users who have previously accepted a sharing invitation or users who you have imported from another Office 365 or Azure Active Directory tenant. 12 | 13 | There are four options for this settings action: 14 | 15 | 1. Disabled 16 | 2. ExistingExternalUserSharingOnly 17 | 3. ExternalUserSharingOnly 18 | 4. ExternalUserAndGuestSharing 19 | 20 | > Note that if a value is not specified, we do not overwrite the value already specified in the tenant. 21 | 22 | 23 | 24 | ## Sample 25 | 26 | Solution|Author(s) 27 | --------|--------- 28 | apply-external-sharing-capability.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 | 42 | 43 | -------------------------------------------------------------------------------- /samples/site-apply-external-sharing-setting/apply-external-sharing-capability.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "schema.json", 3 | "actions": [ 4 | { 5 | "verb": "setSiteExternalSharingCapability", 6 | "capability": "ExistingExternalUserSharingOnly" /* sharing only with existing external users in your directory */ 7 | } 8 | ], 9 | "bindata": { }, 10 | "version": 1 11 | } 12 | 13 | -------------------------------------------------------------------------------- /samples/site-apply-external-sharing-setting/screenshot-site-external-sharing-script-action.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-apply-external-sharing-setting/screenshot-site-external-sharing-script-action.png -------------------------------------------------------------------------------- /samples/site-apply-join-hubsite/README.md: -------------------------------------------------------------------------------- 1 | # Joining site to a hub site 2 | 3 | ## Summary 4 | 5 | This sample illustrates using a joinHubSite script action to automatically join a site to an existing hub site. This script action supports two parameters - the hub site ID (required) and the hub site name (optional). 6 | 7 | To learn more about hub sites: https://support.office.com/en-us/article/planning-your-sharepoint-hub-sites-4e95dcd8-7e79-4732-aa9b-2f351031b4c2?ui=en-US&rs=en-US&ad=US 8 | 9 | To get the hub site ID you can view its source page or use the PowerShell command: `Get-SPOHubSite -Identity ` 10 | 11 | ![Screenshot](screenshot.png) 12 | 13 | ## Sample 14 | 15 | Solution|Author(s) 16 | --------|--------- 17 | site-apply-join-hubsite | Sean Squires 18 | 19 | ## Version history 20 | 21 | Version|Date|Comments 22 | -------|----|-------- 23 | 1.0| August 7, 2018 |Initial release 24 | 25 | ## Disclaimer 26 | **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.** 27 | 28 | --- 29 | 30 | -------------------------------------------------------------------------------- /samples/site-apply-join-hubsite/applyJoinHubSite.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "schema.json", 3 | "actions": [ 4 | { 5 | "verb": "joinHubSite", 6 | "hubSiteId": "d8ab01e9-1634-44dd-91fe-1e6ff8385c34", 7 | "name": "Contoso Operations Center" 8 | } 9 | ], 10 | "bindata": { }, 11 | "version": 2 12 | } -------------------------------------------------------------------------------- /samples/site-apply-join-hubsite/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-apply-join-hubsite/screenshot.png -------------------------------------------------------------------------------- /samples/site-apply-principal-to-spgroup/README.md: -------------------------------------------------------------------------------- 1 | # Adding other users and groups to the site SharePoint groups 2 | 3 | ## Summary 4 | 5 | You can use the addPrincipaltoSPGroup action to add other users and groups to the site SharePoint groups. Note: not O365 Groups. 6 | 7 | Use the addPrincipalToGroup action to manage the addition of users and groups to select default SharePoint groups. For more information, see "Understanding SharePoint Groups" (https://support.office.com/en-us/article/Understanding-SharePoint-groups-94D9B261-161E-4ACE-829E-ECA1C8CD2EB8). This action can be used for licensed users, security groups, and Office 365 Groups. 8 | 9 | This sample illustrates all the various supported permutations. 10 | 11 | ![Screenshot](screenshot.png) 12 | 13 | ## Sample 14 | 15 | Solution|Author(s) 16 | --------|--------- 17 | site-apply-principal-to-spgroup | Sean Squires 18 | 19 | ## Version history 20 | 21 | Version|Date|Comments 22 | -------|----|-------- 23 | 1.0| August 7, 2018 |Initial release 24 | 25 | ## Disclaimer 26 | **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.** 27 | 28 | --- 29 | 30 | -------------------------------------------------------------------------------- /samples/site-apply-principal-to-spgroup/apply-principal-to-spgroup.json: -------------------------------------------------------------------------------- 1 | { 2 | "actions": [ 3 | { 4 | "verb": "addNavLink", /* optional - added to make it easier to access the site group settings */ 5 | "url": "/_layouts/15/user.aspx", 6 | "displayName": "user groups", 7 | "isWebRelative": true 8 | }, 9 | { 10 | "verb": "addPrincipalToSPGroup", 11 | "principal": "myITTeam", /* sg */ 12 | "group": "Owners" 13 | }, 14 | { 15 | "verb": "addPrincipalToSPGroup", 16 | "principal": "myFavoritePeople", /* mail-enabled sg */ 17 | "group": "Members" 18 | }, 19 | { 20 | "verb": "addPrincipalToSPGroup", 21 | "principal": "SeanTeam@contoso.onmicrosoft.com", /* o365 group */ 22 | "group": "Visitors" 23 | }, 24 | { 25 | "verb": "addPrincipalToSPGroup", 26 | "principal": "emilyb@contoso.onmicrosoft.com", /* user */ 27 | "group": "Owners" 28 | } 29 | ] 30 | } 31 | 32 | -------------------------------------------------------------------------------- /samples/site-apply-principal-to-spgroup/readme.txt: -------------------------------------------------------------------------------- 1 | You can use the addPrincipaltoSPGroup action to add other users and groups to the site SharePoint groups. Note: not O365 Groups. 2 | 3 | Use the addPrincipalToGroup action to manage the addition of users and groups to select default SharePoint groups. For more information, see "Understanding SharePoint Groups" (https://support.office.com/en-us/article/Understanding-SharePoint-groups-94D9B261-161E-4ACE-829E-ECA1C8CD2EB8). This action can be used for licensed users, security groups, and Office 365 Groups. 4 | 5 | This sample illustrates all the various supported permutations. 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/site-apply-principal-to-spgroup/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-apply-principal-to-spgroup/screenshot.png -------------------------------------------------------------------------------- /samples/site-apply-regional-settings/README.md: -------------------------------------------------------------------------------- 1 | # Configure Regional Settings for site 2 | 3 | ## Summary 4 | 5 | You can use the `setRegionalSettings` action to configure the regional settings of the site (/_layouts/15/regionalsetng.aspx) 6 | 7 | This sample illustrates how to use the setRegionalSettings site script action to configure the regional settings of a site. This action supports setting the following parameters: 8 | 9 | - Time Zone: a number specifying the time zone. For values see https://msdn.microsoft.com/library/microsoft.sharepoint.spregionalsettings.timezones.aspx 10 | - Locale: a number specifying the culture by LCID. For values see https://msdn.microsoft.com/en-us/library/ms912047(v=winembedded.10).aspx 11 | - Sort Order: a number specifying the sort order. For values see https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spregionalsettings.collation.aspx 12 | - Time Format: a string specifying whether you want to use 12-hour time format or 24-hour format. 13 | 14 | > Note that if a value is not specified, we do not overwrite the value already in the web. 15 | 16 | 17 | 18 | ## Sample 19 | 20 | Solution|Author(s) 21 | --------|--------- 22 | site-apply-regional-settings.json | SharePoint Team 23 | 24 | ## Version history 25 | 26 | Version|Date|Comments 27 | -------|----|-------- 28 | 1.0|April 10, 2018|Initial release 29 | 30 | ## Disclaimer 31 | **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.** 32 | 33 | --- 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /samples/site-apply-regional-settings/apply-regional-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "schema.json", 3 | "actions": [ 4 | { 5 | "verb": "setRegionalSettings", 6 | "timeZone": 2, /* Greenwich Mean Time */ 7 | "locale": 1050, /* Croatia */ 8 | "sortOrder": 6, /* Croatian */ 9 | "hourFormat": "24" 10 | } 11 | ], 12 | "bindata": { }, 13 | "version": 1 14 | } 15 | 16 | -------------------------------------------------------------------------------- /samples/site-apply-regional-settings/screenshot-regionalsettings_updated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-apply-regional-settings/screenshot-regionalsettings_updated.png -------------------------------------------------------------------------------- /samples/site-apply-regional-settings/screenshot-script_action_setregionalsettings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-apply-regional-settings/screenshot-script_action_setregionalsettings.png -------------------------------------------------------------------------------- /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/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-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 | ![picture of the provisioned site](SampleDeptSite.png) 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 | ![Tenant Scoped](tenant-deploy-app-catalog.png) 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-azure-function/Remove-SampleSiteDesign.ps1: -------------------------------------------------------------------------------- 1 | # 2 | # Remove-SampleSiteDesign.ps1 3 | # Removes a custom site design and 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 | 24 | # If credentials were not provided, get them now 25 | if ($Credentials -eq $null) { 26 | $Credentials = Get-Credential -Message 'Enter SharePoint Administrator Credentials' 27 | } 28 | 29 | # Connect to the SharePoint admin service 30 | Connect-SPOService -Url $Url -Credential $Credentials 31 | 32 | # Show existing site designs 33 | Get-SPOSiteDesign 34 | 35 | # Clean up from any previous runs 36 | Get-SPOSiteDesign | Where-Object {$_.Title -eq $SiteDesignName} | Remove-SPOSiteDesign 37 | Get-SPOSiteScript | Where-Object {$_.Title -eq $SiteScriptName} | Remove-SPOSiteScript 38 | 39 | # Show resulting site designs 40 | Get-SPOSiteDesign -------------------------------------------------------------------------------- /samples/site-azure-function/Remove-SampleTheme.ps1: -------------------------------------------------------------------------------- 1 | # 2 | # Remove-SampleTheme.ps1 3 | # Removes a custom theme 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='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 | Remove-SPOTheme -Name $ThemeName 30 | 31 | 32 | -------------------------------------------------------------------------------- /samples/site-azure-function/SampleDeptSite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-azure-function/SampleDeptSite.png -------------------------------------------------------------------------------- /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/tenant-deploy-app-catalog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-azure-function/tenant-deploy-app-catalog.png -------------------------------------------------------------------------------- /samples/site-config-add-dynamic-navlinks-to-Office-365-groups/README.md: -------------------------------------------------------------------------------- 1 | # Add dynamic references to default components of an Office 365 group 2 | 3 | ## Summary 4 | 5 | By default, we already have in an Office 365 group links to the group’s document library, default notebook and mailbox. But how nice would it be to have links visible to users to the default Planner plan, Calendar and Team in the quick launch of an Office 365 group from the beginning? 6 | 7 | In this sample we are adding dynamic references to those default components of an Office 365 group by using the addNavLink script action combined with the _layouts/15/groupstatus.aspx?target= URL. 8 | 9 | ![Screenshot](screenshot.png) 10 | 11 | Here is what the left navigation looks like after the script has been applied: 12 | 13 | ![Screenshot](outcome.png) 14 | 15 | ## Sample 16 | 17 | Solution|Author(s) 18 | --------|--------- 19 | site-config-add-dynamic-navlinks | Jarbas Horst 20 | 21 | ## Version history 22 | 23 | Version|Date|Comments 24 | -------|----|-------- 25 | 1.0| November 18, 2019 |Initial release 26 | 27 | ## Disclaimer 28 | **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.** 29 | 30 | --- 31 | 32 | ## Additional notes 33 | 34 | In this [blog post](https://blog.yannickreekmans.be/generic-urls-for-all-office-365-group-connected-workloads/) Yannick Reekmans explains how to use the _layouts/15/groupstatus.aspx?target= URL in order to create generic URLs for all the Office 365 group connected components. -------------------------------------------------------------------------------- /samples/site-config-add-dynamic-navlinks-to-Office-365-groups/add-dynamic-references-to-default-components-of-an-Office-365-group.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "schema.json", 3 | "actions": [ 4 | { 5 | "verb": "addNavLink", 6 | "url": "/_layouts/15/groupstatus.aspx?target=planner", 7 | "displayName": "Planner", 8 | "navComponent":"QuickLaunch", 9 | "isWebRelative": true 10 | }, 11 | { 12 | "verb": "addNavLink", 13 | "url": "/_layouts/15/groupstatus.aspx?target=calendar", 14 | "displayName": "Calendar", 15 | "navComponent":"QuickLaunch", 16 | "isWebRelative": true 17 | }, 18 | { 19 | "verb": "addNavLink", 20 | "url": "/_layouts/15/groupstatus.aspx?target=team", 21 | "displayName": "Team", 22 | "navComponent":"QuickLaunch", 23 | "isWebRelative": true 24 | } 25 | ], 26 | "bindata": { }, 27 | "version": 1 28 | } -------------------------------------------------------------------------------- /samples/site-config-add-dynamic-navlinks-to-Office-365-groups/outcome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-config-add-dynamic-navlinks-to-Office-365-groups/outcome.png -------------------------------------------------------------------------------- /samples/site-config-add-dynamic-navlinks-to-Office-365-groups/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-config-add-dynamic-navlinks-to-Office-365-groups/screenshot.png -------------------------------------------------------------------------------- /samples/site-config-remove-navlinks/README.md: -------------------------------------------------------------------------------- 1 | # Remove links from the site navigation list 2 | 3 | ## Summary 4 | 5 | You can use the removeNavLink script action to remove links from the site navigation list. This can be especially useful for removing links that are added by default with the collaboration and communication templates. 6 | 7 | In this sample we are removing all of the default links added by the default collaboration (team) template: home, pages, conversations, documents, notebook, site contents. 8 | 9 | 10 | ![Screenshot](screenshot.png) 11 | 12 | ## Sample 13 | 14 | Solution|Author(s) 15 | --------|--------- 16 | site-config-remove-navlinks | Sean Squires 17 | 18 | ## Version history 19 | 20 | Version|Date|Comments 21 | -------|----|-------- 22 | 1.0| August 7, 2018 |Initial release 23 | 24 | ## Disclaimer 25 | **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.** 26 | 27 | --- 28 | 29 | -------------------------------------------------------------------------------- /samples/site-config-remove-navlinks/remove-default-team-template-links.json: -------------------------------------------------------------------------------- 1 | { 2 | "actions": [ 3 | { 4 | "verb": "removeNavLink", 5 | "displayName": "Home", 6 | "isWebRelative": true 7 | }, 8 | { 9 | "verb": "removeNavLink", 10 | "displayName": "Pages", 11 | "isWebRelative": true 12 | }, 13 | { 14 | "verb": "removeNavLink", 15 | "displayName": "Conversations", 16 | "isWebRelative": true 17 | }, 18 | { 19 | "verb": "removeNavLink", 20 | "displayName": "Documents", 21 | "isWebRelative": true 22 | }, 23 | { 24 | "verb": "removeNavLink", 25 | "displayName": "Notebook", 26 | "isWebRelative": true 27 | }, 28 | { 29 | "verb": "removeNavLink", 30 | "url": "/_layouts/15/groupstatus.aspx?Target=TEAM", 31 | "displayName": "Teams", 32 | "isWebRelative": true 33 | }, 34 | { 35 | "verb": "removeNavLink", 36 | "url": "/_layouts/15/viewlsts.aspx", 37 | "displayName": "Site contents", 38 | "isWebRelative": true 39 | } 40 | /* cannot remove recycle bin */ 41 | ] 42 | } 43 | -------------------------------------------------------------------------------- /samples/site-config-remove-navlinks/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-config-remove-navlinks/screenshot.png -------------------------------------------------------------------------------- /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 | ![Provisioning Panel with Actions](screenshot-site_script_advanced_library_configuration_progress_panel.png) 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-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 | -------------------------------------------------------------------------------- /samples/site-create-advanced-lists/screenshot-custom_library_view_by_site_script.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-create-advanced-lists/screenshot-custom_library_view_by_site_script.png -------------------------------------------------------------------------------- /samples/site-create-advanced-lists/screenshot-site_script_advanced_library_configuration_progress_panel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-create-advanced-lists/screenshot-site_script_advanced_library_configuration_progress_panel.png -------------------------------------------------------------------------------- /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 | ![Outcome list configuration](screenshot-custom-list-illustrating-script-configured-view.png) 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 | ![Provisioning Panel with Actions](screenshot-list-configuration-progress-panel) 44 | 45 | 46 | -------------------------------------------------------------------------------- /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-lists2/screenshot-custom-list-illustrating-script-configured-view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-create-advanced-lists2/screenshot-custom-list-illustrating-script-configured-view.png -------------------------------------------------------------------------------- /samples/site-create-advanced-lists2/screenshot-list-configuration-progress-panel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-create-advanced-lists2/screenshot-list-configuration-progress-panel.png -------------------------------------------------------------------------------- /samples/site-create-formatted-lists/README.md: -------------------------------------------------------------------------------- 1 | # Create formatted lists 2 | 3 | ## Summary 4 | You can use the createSPList action to also apply custom column formatting - by including the formatting JSON directly in the site script. For more details on column formatting check out the following article: https://support.office.com/en-us/article/Column-formatting-1f927342-2bed-4745-b727-ff8b7ff96b22?ui=en-US&rs=en-US&ad=US 5 | 6 | And the samples included in the sp-dev-column-formatting repo: https://github.com/SharePoint/sp-dev-column-formatting 7 | 8 | This sample illustrates how to use a site script to create a list and library using the new column formatting feature. It illustrates the following formats: 9 | 10 | - Project Status applies conditional formatting based on the value in the text field 11 | - Assigned To applies an action button to the field 12 | - Effort (days) applies a data bar formatting based on the value in the number field 13 | - Due Date applies conditional formatting based on the date being past current date 14 | 15 | The sample also uses the addNavLink action to add the newly created list and library to the site nav. 16 | 17 | ![Screenshot](screenshot.png) 18 | 19 | ## Sample 20 | 21 | Solution|Author(s) 22 | --------|--------- 23 | site-create-formatted-lists | SharePoint Team 24 | 25 | ## Version history 26 | 27 | Version|Date|Comments 28 | -------|----|-------- 29 | 1.0|December 14, 2017|Initial release 30 | 31 | ## Disclaimer 32 | **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.** 33 | 34 | --- 35 | 36 | ## Additional notes 37 | 38 | This sample is covered in the main documentation aroud Site Designs and Site Scripts. 39 | 40 | - [SharePoint site design and site script overview](https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-overview) 41 | 42 | 43 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /samples/site-create-formatted-lists/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-create-formatted-lists/screenshot.png -------------------------------------------------------------------------------- /samples/site-create-lists-add-to-site-nav/README.md: -------------------------------------------------------------------------------- 1 | # Create lists with specific schema 2 | 3 | ## Summary 4 | You can use the createSPList action to create lists and libraries with a specific schema - and even add them to the site nav. This sample illustrates how to use a site script to create a list and library and then add each of them to the site navigation. It illustrates all of the currently supported data types and also illustrates using the deleteSPField action that could be used for running updates. 5 | 6 | The sample also uses the addNavLink action to add the newly created list and library to the site nav. 7 | 8 | ![Screenshot](screenshot.png) 9 | 10 | ## Sample 11 | 12 | Solution|Author(s) 13 | --------|--------- 14 | site-create-lists-add-to-site-nav | SharePoint Team 15 | 16 | ## Version history 17 | 18 | Version|Date|Comments 19 | -------|----|-------- 20 | 1.0|December 14, 2017|Initial release 21 | 22 | ## Disclaimer 23 | **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.** 24 | 25 | --- 26 | 27 | ## Additional notes 28 | 29 | This sample is covered in the main documentation aroud Site Designs and Site Scripts. 30 | 31 | - [SharePoint site design and site script overview](https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-overview) 32 | 33 | 34 | -------------------------------------------------------------------------------- /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-create-lists-add-to-site-nav/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-create-lists-add-to-site-nav/screenshot.png -------------------------------------------------------------------------------- /samples/site-create-lookup-lists-spfieldxml/README.md: -------------------------------------------------------------------------------- 1 | # Create lookup fields with field xml 2 | 3 | ## Summary 4 | 5 | This sample illustrates using Field XML to create complex list fields - including lookup columns! 6 | 7 | You can use the previously released addSPFieldXml script action to use Field element XML to define other internal data types and declare within a site script. If you wish to define your constructed field as a site column or add to a content type then use the new createSiteColumnXml script action. You can also use the addSPLookupFieldXml script action to create a lookup column to another declared list. For more info see https://msdn.microsoft.com/en-us/library/office/ms437580.aspx 8 | 9 | In this sample script we are: 10 | 11 | 1. creating two choice field site columns - "project status" and "project category" 12 | 2. adding these columns to a content type - "ContosoProjects" 13 | 3. adding the content type to a new project list - along with two text field list columns and overriding the default "all items" list view 14 | 4. creating a second "project tracker" list which illustrates Field XML examples for most data types - including three example lookup fields against the project list - looking up the title, project status and project category fields. The project category field is a multivalue lookup field. 15 | 16 | 17 | ![Screenshot](screenshot.png) 18 | 19 | Outcome in the list is as follows 20 | 21 | ![Screenshot](list_multi_lookup_field.png) 22 | 23 | ## Sample 24 | 25 | Solution|Author(s) 26 | --------|--------- 27 | site-create-lookup-lists-spfieldxml | Sean Squires 28 | 29 | ## Version history 30 | 31 | Version|Date|Comments 32 | -------|----|-------- 33 | 1.0| August 7, 2018 |Initial release 34 | 35 | ## Disclaimer 36 | **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.** 37 | 38 | --- 39 | 40 | -------------------------------------------------------------------------------- /samples/site-create-lookup-lists-spfieldxml/list_multi_lookup_field.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-create-lookup-lists-spfieldxml/list_multi_lookup_field.png -------------------------------------------------------------------------------- /samples/site-create-lookup-lists-spfieldxml/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-create-lookup-lists-spfieldxml/screenshot.png -------------------------------------------------------------------------------- /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-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/.yo-rc.json: -------------------------------------------------------------------------------- 1 | { 2 | "@microsoft/generator-sharepoint": { 3 | "isCreatingSolution": true, 4 | "environment": "spo", 5 | "componentType": "extension", 6 | "extensionType": "ApplicationCustomizer" 7 | } 8 | } -------------------------------------------------------------------------------- /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.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-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.Deployment/SiteScripts/site-script-externalSharing.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "schema.json", 3 | "actions": [ 4 | { 5 | "verb": "setSiteExternalSharingCapability", 6 | "capability": "Disabled" 7 | } 8 | ], 9 | "bindata": {}, 10 | "version": 1 11 | } -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.Deployment/SiteScripts/site-script-joinToHub.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "schema.json", 3 | "actions": [ 4 | { 5 | "verb": "joinHubSite", 6 | "hubSiteId": "2356d439-d907-48dd-9e7b-22fb76464110" 7 | } 8 | ], 9 | "bindata": {}, 10 | "version": 1 11 | } -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.Deployment/SiteScripts/site-script-lists.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "schema.json", 3 | "actions": [ 4 | { 5 | "verb": "createSPList", 6 | "listName": "CnC Documents", 7 | "templateType": 101, 8 | "subactions": [ 9 | { 10 | "verb": "SetDescription", 11 | "description": "Custom Document Library created with Site Designs" 12 | } 13 | ] 14 | } 15 | ], 16 | "bindata": {}, 17 | "version": 1 18 | } -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.Deployment/SiteScripts/site-script-spfxComponents.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "schema.json", 3 | "actions": [ 4 | { 5 | "verb": "installSolution", 6 | "id": "ec530609-85fa-4b7c-9262-1a8be3187bcd" 7 | }, 8 | { 9 | "verb": "associateExtension", 10 | "title": "office-365-site-designs-sp-fx-client-side-solution", 11 | "location": "ClientSideExtension.ApplicationCustomizer", 12 | "clientSideComponentId": "b49e4ec0-127f-4725-87b6-d3b4530c3600", 13 | "clientSideComponentProperties": "{\"Bottom\":\"Footer - added from Site Design\"}", 14 | "scope": "Site" 15 | } 16 | ], 17 | "bindata": {}, 18 | "version": 1 19 | } -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.Deployment/SiteScripts/site-script-theme.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "schema.json", 3 | "actions": [ 4 | { 5 | "verb": "applyTheme", 6 | "themeName": "Deep Purple" 7 | } 8 | ], 9 | "bindata": {}, 10 | "version": 1 11 | } -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.Deployment/SiteScripts/site-script-triggerFlow.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "schema.json", 3 | "actions": [ 4 | { 5 | "verb": "triggerFlow", 6 | "url": "https://prod-20.westeurope.logic.azure.com:443/workflows/b101381036014a63b7b8b3d7e4e905e7/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=QABDIEPzdWfc9onLt1QvBbhsdyXUMP6WhRecNGOfnNw", 7 | "name": "Customise Site with Microsoft PnP", 8 | "parameters": { 9 | "event": "Microsoft Event", 10 | "product": "SharePoint", 11 | "siteType": "CnC Advanced Communication site", 12 | "customMessage": "Item added from Flow!" 13 | } 14 | } 15 | ], 16 | "bindata": { }, 17 | "version": 1 18 | } -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.Deployment/Utilities/ApplyModernTheme.ps1: -------------------------------------------------------------------------------- 1 | $themepallette = @{ 2 | "themePrimary" = "#711bd1"; 3 | "themeLighterAlt" = "#f8f4fd"; 4 | "themeLighter" = "#ede2fa"; 5 | "themeLight" = "#d0b2f1"; 6 | "themeTertiary" = "#a46de3"; 7 | "themeSecondary" = "#7f32d7"; 8 | "themeDarkAlt" = "#6518bc"; 9 | "themeDark" = "#55159f"; 10 | "themeDarker" = "#3f0f75"; 11 | "neutralLighterAlt" = "#f8f8f8"; 12 | "neutralLighter" = "#f4f4f4"; 13 | "neutralLight" = "#eaeaea"; 14 | "neutralQuaternaryAlt" = "#dadada"; 15 | "neutralQuaternary" = "#d0d0d0"; 16 | "neutralTertiaryAlt" = "#c8c8c8"; 17 | "neutralTertiary" = "#c2c2c2"; 18 | "neutralSecondary" = "#858585"; 19 | "neutralPrimaryAlt" = "#4b4b4b"; 20 | "neutralPrimary" = "#333333"; 21 | "neutralDark" = "#272727"; 22 | "black" = "#1d1d1d"; 23 | "white" = "#ffffff"; 24 | "primaryBackground" = "#ffffff"; 25 | "primaryText" = "#333333"; 26 | "bodyBackground" = "#ffffff"; 27 | "bodyText" = "#333333"; 28 | "disabledBackground" = "#f4f4f4"; 29 | "disabledText" = "#c8c8c8"; 30 | } 31 | 32 | Add-SPOTheme -Name "Deep Purple" -Palette $themepallette -IsInverted $false -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.Deployment/Utilities/ApplySiteDesign.ps1: -------------------------------------------------------------------------------- 1 | 2 | $siteDesignToApply = Get-SPOSiteDesign | Where-Object {$_.Title -eq "CnC Basic Communication Site"} 3 | 4 | Invoke-SPOSiteDesign -Identity $siteDesignToApply.ID -WebUrl "https://tenant.sharepoint.com/sites/BasicSite" -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.Deployment/Utilities/ConfigureHubSite.ps1: -------------------------------------------------------------------------------- 1 | Register-SPOHubSite https://tenant.sharepoint.com/sites/DepartmentHubSite -------------------------------------------------------------------------------- /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-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-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-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.PnP/Office365.SiteDesigns.PnP.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | SAK 4 | SAK 5 | SAK 6 | SAK 7 | 8 | 9 | net461 10 | 11 | 12 | 13 | 14 | 15 | 16 | Always 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | PreserveNewest 30 | 31 | 32 | PreserveNewest 33 | Never 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /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.PnP/host.json: -------------------------------------------------------------------------------- 1 | { 2 | } -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | 10 | # change these settings to your own preference 11 | indent_style = space 12 | indent_size = 2 13 | 14 | # we recommend you to keep these unchanged 15 | end_of_line = lf 16 | charset = utf-8 17 | trim_trailing_whitespace = true 18 | insert_final_newline = true 19 | 20 | [*.md] 21 | trim_trailing_whitespace = false 22 | 23 | [{package,bower}.json] 24 | indent_style = space 25 | indent_size = 2 -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Dependency directories 7 | node_modules 8 | 9 | # Build generated files 10 | dist 11 | lib 12 | solution 13 | temp 14 | *.sppkg 15 | 16 | # Coverage directory used by tools like istanbul 17 | coverage 18 | 19 | # OSX 20 | .DS_Store 21 | 22 | # Visual Studio files 23 | .ntvs_analysis.dat 24 | .vs 25 | bin 26 | obj 27 | 28 | # Resx Generated Code 29 | *.resx.ts 30 | 31 | # Styles Generated Code 32 | *.scss.ts 33 | -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "msjsdiag.debugger-for-chrome" 4 | ] 5 | } -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | /** 3 | * Install Chrome Debugger Extension for Visual Studio Code to debug your components with the 4 | * Chrome browser: https://aka.ms/spfx-debugger-extensions 5 | */ 6 | "version": "0.2.0", 7 | "configurations": [{ 8 | "name": "Local workbench", 9 | "type": "chrome", 10 | "request": "launch", 11 | "url": "https://localhost:4321/temp/workbench.html", 12 | "webRoot": "${workspaceRoot}", 13 | "sourceMaps": true, 14 | "sourceMapPathOverrides": { 15 | "webpack:///../../../src/*": "${webRoot}/src/*", 16 | "webpack:///../../../../src/*": "${webRoot}/src/*", 17 | "webpack:///../../../../../src/*": "${webRoot}/src/*" 18 | }, 19 | "runtimeArgs": [ 20 | "--remote-debugging-port=9222" 21 | ] 22 | }, 23 | { 24 | "name": "Hosted workbench", 25 | "type": "chrome", 26 | "request": "launch", 27 | "url": "https://enter-your-SharePoint-site/_layouts/workbench.aspx", 28 | "webRoot": "${workspaceRoot}", 29 | "sourceMaps": true, 30 | "sourceMapPathOverrides": { 31 | "webpack:///../../../src/*": "${webRoot}/src/*", 32 | "webpack:///../../../../src/*": "${webRoot}/src/*", 33 | "webpack:///../../../../../src/*": "${webRoot}/src/*" 34 | }, 35 | "runtimeArgs": [ 36 | "--remote-debugging-port=9222", 37 | "-incognito" 38 | ] 39 | } 40 | ] 41 | } -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | // Configure glob patterns for excluding files and folders in the file explorer. 4 | "files.exclude": { 5 | "**/.git": true, 6 | "**/.DS_Store": true, 7 | "**/bower_components": true, 8 | "**/coverage": true, 9 | "**/lib-amd": true, 10 | "src/**/*.scss.ts": true 11 | }, 12 | "typescript.tsdk": ".\\node_modules\\typescript\\lib" 13 | } -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/.yo-rc.json: -------------------------------------------------------------------------------- 1 | { 2 | "@microsoft/generator-sharepoint": { 3 | "version": "1.5.0", 4 | "libraryName": "office-365-site-designs-sp-fx", 5 | "libraryId": "6f40311e-6d10-4020-a28b-644a946b7c5f", 6 | "environment": "spo", 7 | "packageManager": "npm", 8 | "isCreatingSolution": false, 9 | "componentType": "webpart" 10 | } 11 | } -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/README.md: -------------------------------------------------------------------------------- 1 | ## office-365-site-designs-sp-fx 2 | 3 | This is where you include your WebPart documentation. 4 | 5 | ### Building the code 6 | 7 | ```bash 8 | git clone the repo 9 | npm i 10 | npm i -g gulp 11 | gulp 12 | ``` 13 | 14 | This package produces the following: 15 | 16 | * lib/* - intermediate-stage commonjs build artifacts 17 | * dist/* - the bundled script, along with other resources 18 | * deploy/* - all resources which should be uploaded to a CDN. 19 | 20 | ### Build options 21 | 22 | gulp clean - TODO 23 | gulp test - TODO 24 | gulp serve - TODO 25 | gulp bundle - TODO 26 | gulp package-solution - TODO 27 | -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/config/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json", 3 | "version": "2.0", 4 | "bundles": { 5 | "footer-application-customizer": { 6 | "components": [ 7 | { 8 | "entrypoint": "./lib/extensions/footer/FooterApplicationCustomizer.js", 9 | "manifest": "./src/extensions/footer/FooterApplicationCustomizer.manifest.json" 10 | } 11 | ] 12 | }, 13 | "hello-world-web-part": { 14 | "components": [ 15 | { 16 | "entrypoint": "./lib/webparts/helloWorld/HelloWorldWebPart.js", 17 | "manifest": "./src/webparts/helloWorld/HelloWorldWebPart.manifest.json" 18 | } 19 | ] 20 | } 21 | }, 22 | "externals": {}, 23 | "localizedResources": { 24 | "FooterApplicationCustomizerStrings": "lib/extensions/footer/loc/{locale}.js", 25 | "HelloWorldWebPartStrings": "lib/webparts/helloWorld/loc/{locale}.js" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/config/copy-assets.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/copy-assets.schema.json", 3 | "deployCdnPath": "temp/deploy" 4 | } 5 | -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/config/deploy-azure-storage.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json", 3 | "workingDir": "./temp/deploy/", 4 | "account": "", 5 | "container": "office-365-site-designs-sp-fx", 6 | "accessKey": "" 7 | } -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/config/package-solution.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json", 3 | "solution": { 4 | "name": "office-365-site-designs-sp-fx-client-side-solution", 5 | "id": "6f40311e-6d10-4020-a28b-644a946b7c5f", 6 | "version": "1.0.0.0", 7 | "includeClientSideAssets": true, 8 | "skipFeatureDeployment": false 9 | }, 10 | "paths": { 11 | "zippedPackage": "solution/office-365-site-designs-sp-fx.sppkg" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/config/serve.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json", 3 | "port": 4321, 4 | "https": true, 5 | "serveConfigurations": { 6 | "default": { 7 | "pageUrl": "https://contoso.sharepoint.com/sites/mySite/SitePages/myPage.aspx", 8 | "customActions": { 9 | "b49e4ec0-127f-4725-87b6-d3b4530c3600": { 10 | "location": "ClientSideExtension.ApplicationCustomizer", 11 | "properties": { 12 | "testMessage": "Test message" 13 | } 14 | } 15 | } 16 | }, 17 | "footer": { 18 | "pageUrl": "https://contoso.sharepoint.com/sites/mySite/SitePages/myPage.aspx", 19 | "customActions": { 20 | "b49e4ec0-127f-4725-87b6-d3b4530c3600": { 21 | "location": "ClientSideExtension.ApplicationCustomizer", 22 | "properties": { 23 | "testMessage": "Test message" 24 | } 25 | } 26 | } 27 | } 28 | }, 29 | "initialPage": "https://localhost:5432/workbench", 30 | "api": { 31 | "port": 5432, 32 | "entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/config/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://developer.microsoft.com/json-schemas/core-build/tslint.schema.json", 3 | // Display errors as warnings 4 | "displayAsWarning": true, 5 | // The TSLint task may have been configured with several custom lint rules 6 | // before this config file is read (for example lint rules from the tslint-microsoft-contrib 7 | // project). If true, this flag will deactivate any of these rules. 8 | "removeExistingRules": true, 9 | // When true, the TSLint task is configured with some default TSLint "rules.": 10 | "useDefaultConfigAsBase": false, 11 | // Since removeExistingRules=true and useDefaultConfigAsBase=false, there will be no lint rules 12 | // which are active, other than the list of rules below. 13 | "lintConfig": { 14 | // Opt-in to Lint rules which help to eliminate bugs in JavaScript 15 | "rules": { 16 | "class-name": false, 17 | "export-name": false, 18 | "forin": false, 19 | "label-position": false, 20 | "member-access": true, 21 | "no-arg": false, 22 | "no-console": false, 23 | "no-construct": false, 24 | "no-duplicate-case": true, 25 | "no-duplicate-variable": true, 26 | "no-eval": false, 27 | "no-function-expression": true, 28 | "no-internal-module": true, 29 | "no-shadowed-variable": true, 30 | "no-switch-case-fall-through": true, 31 | "no-unnecessary-semicolons": true, 32 | "no-unused-expression": true, 33 | "no-use-before-declare": true, 34 | "no-with-statement": true, 35 | "semicolon": true, 36 | "trailing-comma": false, 37 | "typedef": false, 38 | "typedef-whitespace": false, 39 | "use-named-parameter": true, 40 | "valid-typeof": true, 41 | "variable-name": false, 42 | "whitespace": false 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/config/write-manifests.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json", 3 | "cdnBasePath": "" 4 | } -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/gulpfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const gulp = require('gulp'); 4 | const build = require('@microsoft/sp-build-web'); 5 | build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`); 6 | 7 | build.initialize(gulp); 8 | -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "office-365-site-designs-sp-fx", 3 | "version": "0.0.1", 4 | "private": true, 5 | "engines": { 6 | "node": ">=0.10.0" 7 | }, 8 | "scripts": { 9 | "build": "gulp bundle", 10 | "clean": "gulp clean", 11 | "test": "gulp test" 12 | }, 13 | "dependencies": { 14 | "@microsoft/sp-core-library": "1.5.0", 15 | "@microsoft/decorators": "1.5.0", 16 | "@types/webpack-env": "1.13.1", 17 | "@types/es6-promise": "0.0.33", 18 | "@microsoft/sp-dialog": "1.5.0", 19 | "@microsoft/sp-application-base": "1.5.0", 20 | "@microsoft/sp-webpart-base": "1.5.0", 21 | "@microsoft/sp-lodash-subset": "1.5.0", 22 | "@microsoft/sp-office-ui-fabric-core": "1.5.0" 23 | }, 24 | "devDependencies": { 25 | "@microsoft/sp-build-web": "1.5.0", 26 | "@microsoft/sp-module-interfaces": "1.5.0", 27 | "@microsoft/sp-webpart-workbench": "1.5.0", 28 | "gulp": "~3.9.1", 29 | "@types/chai": "3.4.34", 30 | "@types/mocha": "2.2.38", 31 | "ajv": "~5.2.2" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/src/extensions/footer/FooterApplicationCustomizer.manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-extension-manifest.schema.json", 3 | 4 | "id": "b49e4ec0-127f-4725-87b6-d3b4530c3600", 5 | "alias": "FooterApplicationCustomizer", 6 | "componentType": "Extension", 7 | "extensionType": "ApplicationCustomizer", 8 | 9 | // The "*" signifies that the version should be taken from the package.json 10 | "version": "*", 11 | "manifestVersion": 2, 12 | 13 | // If true, the component can only be installed on sites where Custom Script is allowed. 14 | // Components that allow authors to embed arbitrary script code should set this to true. 15 | // https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f 16 | "requiresCustomScript": false 17 | } 18 | -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/src/extensions/footer/FooterApplicationCustomizer.module.scss: -------------------------------------------------------------------------------- 1 | @import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss'; 2 | 3 | .app { 4 | .bottom { 5 | height:40px; 6 | text-align:center; 7 | line-height:2.5; 8 | font-weight:bold; 9 | display: flex; 10 | align-items: center; 11 | justify-content: center; 12 | background-color: $ms-color-themePrimary; 13 | } 14 | } -------------------------------------------------------------------------------- /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-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/src/extensions/footer/loc/en-us.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | return { 3 | "Title": "FooterApplicationCustomizer" 4 | } 5 | }); -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/src/extensions/footer/loc/myStrings.d.ts: -------------------------------------------------------------------------------- 1 | declare interface IFooterApplicationCustomizerStrings { 2 | Title: string; 3 | } 4 | 5 | declare module 'FooterApplicationCustomizerStrings' { 6 | const strings: IFooterApplicationCustomizerStrings; 7 | export = strings; 8 | } 9 | -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/src/webparts/helloWorld/HelloWorldWebPart.manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json", 3 | "id": "89ad9b49-0ef2-4fdd-a535-fc08127488cf", 4 | "alias": "HelloWorldWebPart", 5 | "componentType": "WebPart", 6 | 7 | // The "*" signifies that the version should be taken from the package.json 8 | "version": "*", 9 | "manifestVersion": 2, 10 | 11 | // If true, the component can only be installed on sites where Custom Script is allowed. 12 | // Components that allow authors to embed arbitrary script code should set this to true. 13 | // https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f 14 | "requiresCustomScript": false, 15 | 16 | "preconfiguredEntries": [{ 17 | "groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other 18 | "group": { "default": "Other" }, 19 | "title": { "default": "HelloWorld" }, 20 | "description": { "default": "HelloWorld description" }, 21 | "officeFabricIconFontName": "Page", 22 | "properties": { 23 | "description": "HelloWorld" 24 | } 25 | }] 26 | } 27 | -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/src/webparts/helloWorld/HelloWorldWebPart.module.scss: -------------------------------------------------------------------------------- 1 | @import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss'; 2 | 3 | .helloWorld { 4 | .container { 5 | max-width: 700px; 6 | margin: 0px auto; 7 | box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1); 8 | } 9 | 10 | .row { 11 | @include ms-Grid-row; 12 | @include ms-fontColor-white; 13 | background-color: $ms-color-themeDark; 14 | padding: 20px; 15 | } 16 | 17 | .column { 18 | @include ms-Grid-col; 19 | @include ms-lg10; 20 | @include ms-xl8; 21 | @include ms-xlPush2; 22 | @include ms-lgPush1; 23 | } 24 | 25 | .title { 26 | @include ms-font-xl; 27 | @include ms-fontColor-white; 28 | } 29 | 30 | .subTitle { 31 | @include ms-font-l; 32 | @include ms-fontColor-white; 33 | } 34 | 35 | .description { 36 | @include ms-font-l; 37 | @include ms-fontColor-white; 38 | } 39 | 40 | .button { 41 | // Our button 42 | text-decoration: none; 43 | height: 32px; 44 | 45 | // Primary Button 46 | min-width: 80px; 47 | background-color: $ms-color-themePrimary; 48 | border-color: $ms-color-themePrimary; 49 | color: $ms-color-white; 50 | 51 | // Basic Button 52 | outline: transparent; 53 | position: relative; 54 | font-family: "Segoe UI WestEuropean","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif; 55 | -webkit-font-smoothing: antialiased; 56 | font-size: $ms-font-size-m; 57 | font-weight: $ms-font-weight-regular; 58 | border-width: 0; 59 | text-align: center; 60 | cursor: pointer; 61 | display: inline-block; 62 | padding: 0 16px; 63 | 64 | .label { 65 | font-weight: $ms-font-weight-semibold; 66 | font-size: $ms-font-size-m; 67 | height: 32px; 68 | line-height: 32px; 69 | margin: 0 4px; 70 | vertical-align: top; 71 | display: inline-block; 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/src/webparts/helloWorld/HelloWorldWebPart.ts: -------------------------------------------------------------------------------- 1 | import { Version } from '@microsoft/sp-core-library'; 2 | import { 3 | BaseClientSideWebPart, 4 | IPropertyPaneConfiguration, 5 | PropertyPaneTextField 6 | } from '@microsoft/sp-webpart-base'; 7 | import { escape } from '@microsoft/sp-lodash-subset'; 8 | 9 | import styles from './HelloWorldWebPart.module.scss'; 10 | import * as strings from 'HelloWorldWebPartStrings'; 11 | 12 | export interface IHelloWorldWebPartProps { 13 | description: string; 14 | } 15 | 16 | export default class HelloWorldWebPart extends BaseClientSideWebPart { 17 | 18 | public render(): void { 19 | this.domElement.innerHTML = ` 20 |
21 |
22 |
23 |
24 | Welcome to SharePoint! 25 |

Customize SharePoint experiences using Web Parts.

26 |

${escape(this.properties.description)}

27 | 28 | Learn more 29 | 30 |
31 |
32 |
33 |
`; 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/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/src/webparts/helloWorld/loc/en-us.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | return { 3 | "PropertyPaneDescription": "Description", 4 | "BasicGroupName": "Group Name", 5 | "DescriptionFieldLabel": "Description Field" 6 | } 7 | }); -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/src/webparts/helloWorld/loc/mystrings.d.ts: -------------------------------------------------------------------------------- 1 | declare interface IHelloWorldWebPartStrings { 2 | PropertyPaneDescription: string; 3 | BasicGroupName: string; 4 | DescriptionFieldLabel: string; 5 | } 6 | 7 | declare module 'HelloWorldWebPartStrings' { 8 | const strings: IHelloWorldWebPartStrings; 9 | export = strings; 10 | } 11 | -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/Office365.SiteDesigns.SPFx/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "forceConsistentCasingInFileNames": true, 5 | "module": "esnext", 6 | "moduleResolution": "node", 7 | "jsx": "react", 8 | "declaration": true, 9 | "sourceMap": true, 10 | "experimentalDecorators": true, 11 | "skipLibCheck": true, 12 | "typeRoots": [ 13 | "./node_modules/@types", 14 | "./node_modules/@microsoft" 15 | ], 16 | "types": [ 17 | "es6-promise", 18 | "webpack-env" 19 | ], 20 | "lib": [ 21 | "es5", 22 | "dom", 23 | "es2015.collection" 24 | ] 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /samples/site-designs-flow-azure-functions-pnp-hubsites/README.md: -------------------------------------------------------------------------------- 1 | # SharePoint Online Site Designs code samples 2 | 3 | ## Summary 4 | 5 | ### 1. Out of the box Site Scripts and Site Designs 6 | 7 | PowerShell scripts which use the `Add-SPOSiteScript` cmdlet to deploy site scripts to the tenant and the `Add-SPOSiteDesign` cmdlet to combine site scripts to deploy them as Site Designs 8 | 9 | ### 2. Extend Site Designs with Microsoft Flow, Azure Functions and PnP Schema 10 | 11 | Code for using the `triggerFlow` action in a Site Design to call a Flow and pass parameters to it. Flow passes the parameters to an Azure Function which then applies PnP schema to the site which executes the Site Design. 12 | 13 | ### 3. Apply Site Design to existing modern site 14 | 15 | Using the `Invoke-SPOSiteDesign` cmdlet to apply a Site Design to an existing modern site. 16 | 17 | ### 4. Join site to a Hub site using a Site Design 18 | 19 | Configure a Hub site on the tenant using the `Register-SPOHubSite` cmdlet and join the current site to a Hub site using the `joinHubSite` site design action 20 | 21 | ### 5. Sample SPFx solutions used to deploy from Site Designs 22 | 23 | Hello world SPFx web part and Application Customizer (for footer) which is deployed to a site using the `installSolution` and `associateExtension` actions in a Site Design. 24 | 25 | ### 6. Modern themes 26 | 27 | Creating and deploying modern themes with the `Add-SPOTheme` cmdlet 28 | 29 | ## Sample 30 | 31 | Solution|Author(s) 32 | --------|--------- 33 | site-designs-flow-azure-functions-pnp-hubsites | Vardhaman Deshpande ([@vrdmn](https://twitter.com/vrdmn)), Content and Code 34 | 35 | ## Version history 36 | 37 | Version|Date|Comments 38 | -------|----|-------- 39 | 1.0|July 22, 2018|Initial release 40 | 41 | ## Disclaimer 42 | **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.** 43 | 44 | -------------------------------------------------------------------------------- /samples/site-register-spfx-extension/README.md: -------------------------------------------------------------------------------- 1 | # Associate SharePoint Framework extension to a site 2 | 3 | ## Summary 4 | 5 | Use the associateExtension action to register a deployed SharePoint Framework extension from the tenant app catalog. 6 | 7 | For more details on how to create and configure a SharePoint Framework extension, check out: [Overview of SharePoint Framework Extensions](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/overview-extensions). 8 | 9 | ![Screenshot](screenshot.png) 10 | 11 | ## Sample 12 | 13 | Solution|Author(s) 14 | --------|--------- 15 | site-register-spfx-extension | Sean Squires 16 | 17 | ## Version history 18 | 19 | Version|Date|Comments 20 | -------|----|-------- 21 | 1.0| August 7, 2018 |Initial release 22 | 23 | ## Disclaimer 24 | **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.** 25 | 26 | --- 27 | 28 | -------------------------------------------------------------------------------- /samples/site-register-spfx-extension/readme.txt: -------------------------------------------------------------------------------- 1 | Use the associateExtension action to register a deployed SharePoint Framework extension from the tenant app catalog. 2 | 3 | For more details on how to create and configure a SharePoint Framework extension, check out: Overview of SharePoint Framework Extensions (https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/overview-extensions). 4 | 5 | -------------------------------------------------------------------------------- /samples/site-register-spfx-extension/register_extension.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "schema.json", 3 | "actions": [ 4 | { 5 | "verb": "installSolution", 6 | "id": "c59e2c4a-e7ef-4a88-ae8f-c770abfc150a", 7 | "name": "Application Customizer for Page Header Footer" 8 | }, 9 | { 10 | "verb": "associateExtension", 11 | "title": "SPFXApplicationCustomizer Example", 12 | "location": "ClientSideExtension.ApplicationCustomizer", 13 | "clientSideComponentId": "40d64749-a6e5-4691-b440-1e32fb6bfea5", 14 | "scope": "Web" 15 | } 16 | ], 17 | "bindata": { }, 18 | "version": 1 19 | } -------------------------------------------------------------------------------- /samples/site-register-spfx-extension/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/site-register-spfx-extension/screenshot.png -------------------------------------------------------------------------------- /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 | ![outcome list](updated_triggerFlow_properties.png) 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/triggerFlow-write-back-site-properties-to-splist/request-body-json-schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "object", 3 | "properties": { 4 | "webUrl": { 5 | "type": "string" 6 | }, 7 | "webDescription": { 8 | "type": "string" 9 | }, 10 | "creatorName": { 11 | "type": "string" 12 | }, 13 | "creatorEmail": { 14 | "type": "string" 15 | }, 16 | "createdTimeUTC": { 17 | "type": "string" 18 | }, 19 | "parameters": { 20 | "type": "object", 21 | "properties": { 22 | "event": { 23 | "type": "string" 24 | }, 25 | "product": { 26 | "type": "string" 27 | } 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /samples/triggerFlow-write-back-site-properties-to-splist/updated_triggerFlow_properties.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnp/sp-dev-site-scripts/e84c224e16ffac6ebf74ec5fc415d9e9fe49dd5e/samples/triggerFlow-write-back-site-properties-to-splist/updated_triggerFlow_properties.png --------------------------------------------------------------------------------