Vue normale

Il y a de nouveaux articles disponibles, cliquez pour rafraîchir la page.
À partir d’avant-hierFlux principal

Create a SharePoint online site using Power Automate flow

In this article, I will demonstrate how to provision a SharePoint online modern site using a Power automate flow. As there is no standard Power automate action for creating a SharePoint site (previously called “site collections”) using SharePoint connector, we will use the Send an HTTP Request to SharePoint action and SharePoint REST API in Power automate flow.

Follow below steps to create a SharePoint online modern communication site using Power Automate flow:

1. Go to make.powerautomate.com and create a new Instant cloud flow with Manually trigger a flow trigger.

2. Add Send an HTTP request to SharePoint action in Power automate flow.

3. Use configurations for Send an HTTP request to SharePoint action in below format:

MethodPOST

Uri_api/SPSiteManager/create

Headers:

{
	"accept": "application/json;odata=verbose",
	"content-type": "application/json;odata=verbose"
}

Body:

{
	"request": {
		"Title": "My Communication Site",
		"Url": "https://contoso.sharepoint.com/sites/MyCommSite",
		"Description": "My Communication Site created using Power Automate flow",
		"Owner": "gsanap@contoso.com",
		"Lcid": 1033,
		"WebTemplate": "SITEPAGEPUBLISHING#0",
		"SiteDesignId": "6142d2a0-63a5-4ba0-aede-d9fefca2c767",
		"ShareByEmailEnabled": false
	}
}

Where,

Url

URL for the new SharePoint online modern site (site collection)

LCID

Locale identifier (LCID) for the site language. 1033 is for English language, check LCID for other languages at: Language.Lcid property

WebTemplate

WebTemplate property is used to specify which type of SharePoint site to you want to create. You can use following values for this property:

  • Communication Site: SITEPAGEPUBLISHING#0
  • Team Site (not connected to M365 group): STS#3

SiteDesignId

SiteDesignId property is used to apply site template (previously called “site design”) to newly created SharePoint site.

If you want to apply an out-of-the-box available site template, use the following values:

  • Topic: 96c933ac-3698-44c7-9f4a-5fd17d71af9e
  • Showcase: 6142d2a0-63a5-4ba0-aede-d9fefca2c767
  • Blank: f6cc5403-0d63-442e-96c0-285923709ffc

ShareByEmailEnabled

If this property is set to true, it will enable sharing SharePoint files via Email.

Your final Power automate flow should look like this:

Create a SharePoint online modern communication site using Power Automate flow and SharePoint REST API
Create a SharePoint online site using Power Automate flow

4. Save your flow and Run it using Test > Manually options at the top right corner. After flow run completes successfully, navigate to the site URL mentioned in Send an HTTP request to SharePoint action in Power automate flow and you will see a newly created SharePoint online modern communication site like:

SharePoint online modern communication site created using Power Automate flow and SharePoint REST API with Send an HTTP request to SharePoint action
SharePoint online modern communication site created using Power Automate

Learn more

SharePoint: Configure Navigation Links to Open in a New Tab

Previously in SharePoint site when you click on the navigation link, the default behavior was to open internal links in the same browser tab and external links in a new browser tab. Now, Microsoft is releasing a new feature which will allow users to manage the experience for each navigation link item to open in the same tab or in a new tab.

This new feature will add new Open in a new tab option in navigation link settings. Open in a new tab option is available while adding new navigation links or editing existing navigation links. Using this feature, users will have the option to be able to choose to open navigation links in the same tab or in a new tab for:

This feature is available for both SharePoint communication sites and team sites navigation.

Follow below steps to configure navigation link item to open in a new tab:

1. Go to your SharePoint site and click on Edit link at the bottom of the vertical navigation (or to the right of the horizontal navigation).

Vertical navigation in SharePoint team site

2. Hover in between the existing navigation links in the menu where you want to add a new link and select + icon.

3. On the Add a link dialog box, choose Link under Choose an option dropdown and enter web address & display name for the navigation link.

4. You can see the new Open in a new tab option at the bottom of Add a link dialog box. Select the Open in a new tab checkbox to open the navigation link in a new browser tab.

SharePoint online - configure site or hub navigation links to open in a new tab
SharePoint – Configure Navigation Links to Open in a New Tab

5. Click OK on Add a link dialog box and then Save the navigation settings. Now, when you click on the newly added navigation link item, it will open the associated web address in a new browser tab.

Note: The new open in new tab experience will not work on the footer navigation links when initially available. This will become available with future release at a later date.

Release Timeline

  • Targeted Release: Microsoft began rolling out this feature in early September and it is expected to complete the rollout by late September.
  • Standard Release: Microsoft will begin rolling out this feature in late September and expects to complete the rollout by mid-October.

You can read more about this feature and rollout (General Availability) information at Microsoft 365 Roadmap ID 93318.

Site templates are coming to SharePoint Online

Microsoft is introducing scenario-based site templates in SharePoint online. This new SharePoint release of scenario-based site templates will help you expand what’s possible with content, pages, and web parts while helping you quickly get started building your own site.

Each template contains pre-populated content and web parts that are fully customizable to meet the needs of your organization. This feature is rolling out on SharePoint Online web and mobile.

This feature is associated with Microsoft 365 Roadmap ID 70574.

How this will affect your organization

Users will be able to benefit from the ability to browse, preview, and apply site templates to a new or existing SharePoint site. Users can select a site template that meets organizational business objectives and best fits the site goal while ensuring a higher level of consistency throughout their organization. They can then review pre-populated content and customize the site to address their needs.

This feature is by default ON with no admin control.

Apply a template to an existing site

Users can choose to browse site templates and can apply a template to an existing site at any time by accessing the template gallery from Site Settings and then Apply a site template.

Apply a template when you create a new site

If a site owner is visiting their new site for the first time, they may see a message asking if they want to use a template that will take them to the site templates gallery.

Choose or Select a site template in SharePoint online modern experience
Select a site template in SharePoint online
Preview and apply selected site template to SharePoint online modern experience site
Preview and apply selected site template
Note

When you apply a template to an existing site, your content will not automatically merge with the new template. Instead, a new default home page will be created along with other new content. Existing pages, libraries, and lists will be saved and can be accessed in Site contents.

Available scenario-based site templates

Communication site templates
Site templateDescription
DepartmentEngage and connect viewers with departmental news, highlight upcoming events, and provide easy access to frequently accessed files.
Leadership connectionBuild organizational culture by connecting leadership and team members through engaging in conversation, news, and events.
Learning centralProvide an internal landing experience for your organization that serves as the single place where events, news, and extra-curricular resources are showcased.
New employee onboardingStreamline and refine new hire onboarding by engaging and guiding new employees through your onboarding process.
ShowcaseSpotlight a product, event, or team using visual content like images and video. 
TopicEngage viewers with informative content like news, announcements, and events. 
BlankCreate your own custom site starting with a blank home page. 
Team site templates
Site templateDescription
Event planningCoordinate and plan event details with your team. Use ready-made event recap and event status news post templates to quickly get your team up to date.
Project managementCreate a collaboration space for your team where you can access frequent tools, share project updates, post meeting notes, and upload team documents.
Training and coursesPrepare course participants and students for specific learning opportunities by sharing course resources, news, and events.
Training and development teamBrainstorm and plan opportunities to help others learn and grow.
Team collaborationManage projects, share content, and stay connected with your team.
From your organization

Site templates created by your organization, also known as third-party templates, can be found in the tab titled From your organization when selecting a site template. Customization instructions will vary depending on the site template design.

Notes
  • In previous versions of SharePoint, site templates were called site designs but will be referred to as site templates moving forward.
  • The Site designs entry point will be replaced by the Apply a site template entry point in the Settings panel.
  • In this new site template experience, a progress screen is displayed while the site template is being applied instead of a notification bar.
  • Today, the new site template experience cannot be disabled and you cannot view template version history but will be included in future updates.

Release Timeline

Targeted Release (Selected users and organization): Microsoft will begin rollout in late June (previously late May).

Standard Release: Rolling out in late August (previously late July).

What you need to do to prepare

  1. Share this template guide with end-users: Learn how to apply and customize SharePoint site templates.
  2. For tips on improving and customizing your site, review the SharePoint Next steps panel.
    • The Next steps experience currently exists on Team sites and is now being introduced to Communication sites.
  3. For admins using custom site templates (previously known as site designs and sometimes called third-party templates), review learn how to create a custom site template and site script.

Set up a home site in SharePoint Online

Microsoft is currently rolling out SharePoint app bar and Global navigation to SharePoint online tenants. By default the home icon in app bar is linked to the SharePoint start page. To change this behavior, you need to enable the global navigation. Enabling and customizing global navigation in SharePoint requires a home site.

SharePoint online home site is also required to use Microsoft Viva connections in Microsoft Teams desktop client.

So, if you are planning to customize the global navigation or use Microsoft Viva connections in Microsoft Teams, first you have to set up a home site for your SharePoint online tenant. Home site is a SharePoint site that you create and set as the top landing page for all users in your intranet. You can set only one SharePoint site as a home site which must be a communication site.

Steps to set a site as your home site

  1. Create a communication site to set it as the home site or use existing communication site.
  2. Customize the communication site by adding navigation, header, footer, site logo, news, events and other web parts as per your requirements and brand.
  3. Use PowerShell commands to set a communication site as the home site.

Use PowerShell to set a communication site as the home site

After you create and customize the communication site that you want to use as your home site, you need to run a PowerShell commands to set it as your home site. To run this commands, you must be a global admin or SharePoint admin in your Microsoft 365 tenant.

Using SharePoint Online PowerShell

1. Download the latest version of SharePoint Online Management Shell.

2. Connect to SharePoint admin site as a global admin or SharePoint admin using below command:

Connect-SPOService -Url https://<tenant>-admin.sharepoint.com

3. Run below command to set a communication site as the home site:

Set-SPOHomeSite -HomeSiteUrl https://<tenant>.sharepoint.com/sites/<communicationsite>
Using PnP PowerShell

You can use PnP PowerShell Set-PnPHomeSite command to set the home site for your SharePoint tenant.

Connect-PnPOnline -Url https://<tenant>-admin.sharepoint.com/ -Interactive
Set-PnPHomeSite -HomeSiteUrl "https://<tenant>.sharepoint.com/sites/<communicationsite>"
Using CLI for Microsoft 365

You can use CLI for Microsoft 365 spo homesite set command to set the specified communication site as the Home Site.

m365 login
m365 spo homesite set --siteUrl https://<tenant>.sharepoint.com/sites/<communicationsite>

Points to remember

  • Only one communication site can be set as the home site.
  • Search scope for the site will be changed to tenant-wide search.
  • The site will be automatically set up as an organization news site.
  • The first time you set up a home site, it might take up to several minutes for the changes to take effect.
  • If you run the above command again to switch your home site to a different site, it might take up to 2 hours.
  • Home site can be registered as a hub site, but it can’t be associated with a hub.

Unregister a home site from your tenant

If you have registered a site as a home site in your tenant previously and now you don’t want to have any home site in your tenant, you need to run the following PowerShell command with administrator privileges:

Remove-SPOHomeSite

This removes the current SharePoint Online Home Site setting. Note that you do not need to specify the URL of your home site.

Learn more

Grant Permissions to All Communication Sites Associated with a Hub Site

This isn’t rocket science, but it’s something I do often enough that I want to lodge the PowerShell in a post instead of continuing to rewrite it.

When we are building an Intranet, we often want to grant permissions for all the Communication Sites to a small set of people during the testing process. This script will do that for one user.

Here is a quick overview of what is happening:

  • Everything before line 12 is just set up. I define a few variables pointing to the Admin Site and Hub Site. I connect to the Admin Site in line 9, and then I have a token which is reusable for all the other connections.
  • In line 12, I get all the sites which are associated with the Hub Site. In this case, it is the root site in the tenant and also a Home Site. This is the most common setup for an Intranet.
  • Next I loop through all the associated sites. The first step is to connect to each site.
  • I’m finding both the Owners and Members groups in lines 16-17. We may want to make some people Owners and other People Members, and we can use the appropriate group in line 18.
  • Communication Sites don’t have backing Microsoft 365 Groups, so I can use the Add-PnPGroupMember cmdlet, which just adds the user(s) to the correct SharePoint group.
  • You could duplicate line 18 to grant permissions to more than one person.
# Import modules
Import-Module PnP.PowerShell

# Base variables
$adminUrl = "https://tenant-admin.sharepoint.com/"
$HubSiteURL = "https://tenant.sharepoint.com/"

# Connect to the tenant
Connect-PnPOnline -Url $adminUrl -Interactive

# Get the sites associated with the Intranet Hub Site
$associatedSites = Get-PnPHubSiteChild -Identity $HubSiteURL | Sort-Object 

foreach ($site in $associatedSites) {
    Connect-PnPOnline -Url $site -Interactive
    $ownerGroup = (Get-PnPSiteGroup | Where-Object { $_.LoginName -like "*Owner*" })[0]
    $memberGroup = (Get-PnPSiteGroup | Where-Object { $_.LoginName -like "*Member*" })[0]
    Add-PnPGroupMember -LoginName "lester.frogbottom@tenant.com" -Group $ownerGroup.LoginName

}

I know the best way to do this is by using a Microsoft 365 Group, but this down and dirty approach makes sense in a limited way. When we launch the Intranet, we’ll clean out all the Members and Visitors to start fresh, so it doesn’t matter that much if we are a bit messy for now. Plus, we may be granting temporary Member permissions to someone just during the build phase.


Eagle-eyed reader Brian McCullough (@bpmccullough) pointed out I was working too hard to get the Member and Owner groups.

Get-PnPGroup -AssociatedOwnerGroup -AssociatedMemberGroup -AssociatedVisitorGroup would these work instead?

— Brian McCullough (@bpmccullough) September 30, 2021

Rather than these two lines:

$ownerGroup = (Get-PnPSiteGroup | Where-Object { $_.LoginName -like "*Owner*" })[0]
$memberGroup = (Get-PnPSiteGroup | Where-Object { $_.LoginName -like "*Member*" })[0]

We can do this:

$ownerGroup = Get-PnPGroup -AssociatedOwnerGroup
$memberGroup = Get-PnPGroup -AssociatedMemberGroup
❌
❌