Building a Modern Flat Project Hub using Site Designs

Reading Time: 5 minutes

This post will walk thru a simple example of building a Project Hub by provisioning modern Project sites for an organization using the new SharePoint site design and site script capabilities. It’s important to standardize sites across your tenant, particularly in flat site architectures where there are lots of sites being provisioned. If you find yourself repeating the same configuration over-and-over again when provisioning sites, this is a good indication it should be automated as a site design. Follow along and I’ll show how to do just that for an organization’s Project sites!

For the non-developers out there… don’t let a bit of JSON and PowerShell scare you away. I want to demonstrate how easy and intuitive this was to do. With a bit of JSON knowledge and a few PowerShell commands, you can have a Site Design deployed to your tenant in a short period of time. (as long as your requirements aren’t too complex)

You can choose to “hand-roll” the JSON, as I’ve done here, or check out a great PnP solution, Site Designs Studio, contributed by Yannick Plenevaux to assist in creating/changing the site scripts and site designs: https://github.com/SharePoint/sp-dev-solutions/tree/master/solutions/SiteDesignsStudio

Note: for more advanced site designs including SharePoint Framework solutions, Azure functions and Microsoft Flow, check out a recent post by Bob German titled Building SharePoint Site Designs with Themes and Azure functions.


Pre-setup

The steps in this post assume we have a Project Hub site already created. For this post, I’ve created a new modern Communication site and identified it as a Hub on the tenant.

[Update April 2021] You can now make a SharePoint site a Hub thru the UI of the SharePoint Admin Center.

ProjectHubbify

I’ve updated the Hub navigation to include links to organizational project resources to demonstrate how navigation will be shared with any Project sites joined to the Hub. (Project Templates, Corporate Project Dashboard)

ProjectSiteBeforeAnyJoined
The Project Hub

Following are the 4 high-level steps to create a custom Project Site design that will be automatically included in the Project Hub:

  1. Define resources and actions to be taken when a Project site is created
  2. Build the site script JSON file to do them using actions
  3. Add the site script and site design to the tenant via PowerShell
  4. Create a Project site with the design to test!

Step 1: Decide on Project Site Resources and Actions

  • Project Document content type to include site columns:
    • Project name: single line of text
    • Document type: choice (Requirements, Design, TestPlan, Project Charter)
  • Create new Project Documents library
  • Add Project Document content type to the new library
  • Remove Document content type from the new library
  • Add Project Documents library to the navigation
  • Remove Documents, Pages, and Site Contents from the navigation
  • Add the Project site to the Project Hub

Step 2: Build JSON File

Using the Site design JSON schema reference, I built a JSON file with the actions to complete the project site resources. I used the following actions:

  • createSiteColumn – Project name column
  • createSiteColumnXml (for the choice column) – Document type column
  • createContentType – Project Document content type
  • addSiteColumn – add site columns to the Project Document content type
  • createSPList – create Project Documents library
  • addContentType – add Project Document content type to library
  • removeContentType – remove Document content type from library
  • addNavLink – add nav for Project Documents library
  • removeNavLink – remove miscellaneous nav links
  • joinHubSite – join Project Site to the Project Hub

Here is the JSON file with the above site actions: (if you don’t see the expanded source, click on the link)

I saved the file as C:\Scripts\ProjectSitescript.json


Step 3: Add Site Script and Site Design to the Tenant

This is done using PowerShell. First, you add the saved JSON file from above as a site script and then use it for your site design. I’m referencing the Team Site web template (64) in my Site Design since I want the Project Site to use the Team Site template:

PowershellToAdd


Step 4: Create a Site with the Design

Ready to test! When I click Create site from the SharePoint app and select the Team Site tile, I’m now presented with 2 options on the design dropdown. It’s pulling the Title property from the Site Design I created, Project Site. I select it and enter a test name for my new Project site, Joanne’s Special Project:

The site is initially created and then the site script runs to complete all actions defined in the JSON file. A pane on the right-hand side of the page displays the results of each action as it’s done. I find this very helpful.

SiteScriptRunningStatus

and voila! The site is ready. I check the Project site’s navigation and the Project Documents library and they’re exactly as I’d specified in the JSON file. Since Joanne’s Special Project site has been joined to the Project Hub, I also see the navigation from the Hub:

There are numerous use-cases for a Project Site design like this and many more things could be added. The benefit of having Project Documents standardized across the tenant is that it allows us to roll them up in a summarized way. For example, we could put a Highlighted Content web part on the Project Hub to display all Project Charter documents from all Project Sites. Standardizing Information Architecture like this makes this a relatively easy thing to do.

[Update July 16, 2019] Now that Retention can be auto-applied based on a Content Type, we can now apply retention on all Project Documents across the Project Hub. Just add ContentType:’Project Document’ as a condition to apply it.

By automatically joining all Project sites to the Project Hub, they all share a common navigation, search is scoped to only the Project sites, and they share a common theme. Excellent!


My thoughts

Kudos to the team at Microsoft responsible for this provisioning mechanism. I’m really impressed at how well this worked and how quickly it came together. The hardest part for me was ensuring the JSON file was correctly formatted and that I had everything defined within it. I’ll definitely be building out site templates for tenants I work in to help with the structure and organization of SharePoint sites, particularly in the modern, flat site architecture world we all live in.

Thanks for reading.

-JCK

22 comments

  1. Great stuff, as always. I know it’s in there already, but perhaps underscore (up front) what this does relative to OOTB hub creation and site association/configuration.

  2. Thanks Joanne

    Out of interest how would you show a nice list of these associated project sites on the parent hub/project hub?

    We have the “sites” webpart but that is limited to 99 and a filmstrip /cards layout. So if you had a programme of work (hub) with 100+ projects how would you go about showing that list in a modern site.

    thanks

    1. Hi Brad,
      I’m not aware of a way using ‘out-of-the-box’ capabilities to do that in an automated way. If you’re willing to write a custom web part to do it, that would work. It would need to dynamically determine all sites joined to the hub at any point-in-time and then display links to them.

      A “light-weight” way you could do it is update a SharePoint list on the Hub every time a Project site was joined to the Hub (in the site script). I don’t mind this option as you could include some metadata on the type of site it is and group your projects by that piece of metadata. However… you would also need to handle removing it when the site was removed. It could get complicated quickly (it would perhaps be sufficient until something came out-of-the-box)

      I haven’t spent any time working thru a solution – this would be an excellent idea for a post. 🙂

      -JCK

  3. Hey Joanne! Thanks for sharing, but could you share the JSON? I’m trying to do something similar to what you are doing, but in the moment that I reference in the JSON to add the Content Type the columns that I created or even to associate the CT to the List, I am receiving an error. I wonder if it’s possible to check with your JSON and check which differences do we have. Thanks!

  4. Hi Joanne, looks like we can’t use content types on the Hub in associated sites. In your example, the ‘Project Document’ content type is in the global content hub? Then to retrieve the roll-up of project documents by Project Charter, you’ve created a managed property for the content type columns – Document Type etc.. Is that correct? Thank you, great article.

    1. Hi Nicolle,
      In my example, the content types were defined on each associated site joined to the Hub thru the site actions as part of the ‘Project site’ design. I blog about how this is done in another post: https://joannecklein.com/2018/08/27/search-using-a-sharepoint-hub-source/

      Soon, there will be additional actions available such that when a site joins a Hub, you will be able to automatically add site columns and content types to the site joining the hub. When that functionality comes, that will be another way to accomplish the same thing.

      Hope that helps.
      -JCK

  5. Hi Joanne, I was wondering why you choose to define the content types on each new project site instead of defining the content type in the global content type hub. In that case, whenever you would change one of the content types in the global content type hub, the changes would get pushed to all sites. In your case you will have to manually change all site content types in all created project sites individually in case you would like to change a content type. What made you decide to do it this way as mentioned in your blog?

    1. Hi Marc,
      I chose to do it this way simply to demonstrate the ‘Create site column’, ‘Create content type’, and ‘Join to hub’ functionality using the new site actions and site design capabilities in Modern SharePoint. Once the site actions are introduced to fire when a site is joined to a hub, it would be better to control the content type ‘Push’ from the Hub. I don’t believe this capability is there yet, but it is definitely coming. I believe this will be the ‘start’ of a modern replacement to the Global Content Type Hub.
      The Global Content Type Hub needs some work imo and I wanted to demonstrate new functionality.
      -JCK

      1. Thanks Joanne for your answer. Makes perfectly sense. Migrating now to Hubs and flat site structure. Managing content types from the new Hub sites instead of the Global Content type Hub would indeed be a great improvement.

  6. Thank you. I have done exactly same in our organization. But, here is the problem I am facing. As project sites are growing day by day the content type used is scoped to project site. If we like to add a column then it is a problem as there are 100’s of project sites already created using this project site template/site design. Is there any way to use the content type from “content type hub” instead of site content type in site script?

    1. Hi Praveen, I wouldn’t recommend that since it’s mixing classic and modern and the results may not be predictable. I would stick with site designs and use the Get-SPOSiteDesignRun and Get-SPOSiteDesignRunStatus cmdlets to know which sites your design has been deployed against and reapply your updated site design (with content type changes) against them.
      -JCK

  7. Hi
    First of all – I love your site. So much information og tips to use in developing our SharePoint site.

    One question : We consider to use Teams as project site with planner added. Do you know if creation of Teams can be done the same way as described above.

    /Charley

    1. Hi Charley, you need to call an Azure Job from your Flow so you can invoke PowerShell to provision a Teams.
      -JCK

  8. Hi Joanne,
    It is a great post. It’s been a while but I hope you could shed some light even with the new features that are being released as the time goes.
    I have a requirement to have Document Templates as part of the Libraries. I am not able to include that using the Site Script / Site Design. Would you have any recommendation to achieve that? I don’t mind if it needs to be done using a Flow for example.

    Thank you.

    1. Hi,
      I don’t have any experience implementing this, however it sounds like it would be a very useful feature! Please reach out to the larger Tech Community for a wider audience on your question.
      -JCK

Leave a Reply to BradCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.