Monday, August 12, 2019

Teamify Group with SharePoint Site Designs and Microsoft Flow - Part 3 - The Site Design

In the previous posts we looked at the following steps:

1. Register an Azure App
2. Create the Microsoft Flow

In this post, I will continue with steps "Create the Site Script", "Create the Site Design" and "Apply the Site Design".

Important: You may need to update your SharePoint Online Management Shell to the version 16.0. 8525.1200 or later, in order to use the demonstrated PowerShell commands below.


3. Create the Site Script

The Site Script consists of only one action, namely the triggerFlow action ðŸ™‚ We will configure the url property with the trigger URL we got in step 2. Your Site Script could be much more complex than my sample is. I'm reducing the script's actions to only one in order to focus on the essentials. The script below shows the entire Site Script that we need to reach our goal:

{
    "$schema""schema.json",
        "actions": [
            {
                "verb""triggerFlow",
                "url""https://prod-64.westeurope.logic.azure.com:443/workflows/a279d12d8f224658b5e442bd47f6ac18/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=ITP8ZIj9iIJKxAOQP-JwbRzCihJj5nlZDZod6jQI3JC",
                "name""Migrate group to team",
                "parameters": {
                    "event""",
                    "product"""
                }
            }
        ],
        "bindata": { },
        "version"1
}

After creating the script, it is time to add it to the Site Script's pool in SharePoint. After authentication, the first line of code gets the script from the clipboard and saves it in a variable. The next line of code adds the script to Site Script's pool and holds the request response in a variable which contains all information about the new Site Script. This variable will be used in step 4. The PowerShell script below demonstrates this logic:


4. Create the Site Design

In my sample, I want Office 365 groups to always be converted into Teams as soon a new group is created. Hence, I'll set up the Site Design as default. In this step we only need PowerShell to add a new Site Design configured with the Site Script just created. The script below shows how to add the Site Design:

Once we get the call response, the Site Design is ready for use in SharePoint.


5. Apply the Site Design

There are different ways to apply a Site Design to a SharePoint site collection. The table below lists some of these possibilities:

ChannelCaseNotes
SharePoint User InterfaceCreating a new Site CollectionBy design, the Site Design which has been associated to the default template won't appear in the Site Design dropdown. Instead, it continues to show the title, description and image of the default template
SharePoint User InterfaceIn an existing Site CollectionDifferent from the first case, the custom default Site Design appears in the Site Design dropdown
PowerShellInvoke-SPOSiteDesignRemember the actions limitation which is 30
PowerShellAdd-SPOSiteDesignTaskRemember the actions limitation which is 300

In my sample, I'll apply the site design during site collection creation. As explained in the table above, don't get confused if our Site Design Teamify group isn't listed in the Site Design dropdown. It is there! But it is named Team site. The picture below shows what it looks like:


After completing the site collection form, it doesn't take long, and the new Team appears in Microsoft Teams. It means that our Office 365 Group was successfully converted into a Team. If you configure your Site Script with a specific list structure, all your Teams will profit from it. You could also go beyond this conversion process. For instance, you could increment your Flow with the capability to create a tab in your team that points to a SharePoint list which has been provisioned using Site Designs.

Summary:

There are many possibilities for working with Site Designs. Microsoft has offered us the integration between Site Designs and Flow. It's up to us to decide what to do with it. The integration to Flow alone would suffice, since you could execute further provisioning steps using PnP or Graph.

The triggerFlow action is an open-door feature. Try it out if you haven't already. Create fancy integrations with Flow because it is possible!

Links:
Calling Microsoft Flow from a site script
Using Flow with Graph API
Accessing Graph API from Microsoft Flow using application permissions

No comments:

Post a Comment