編輯

共用方式為


Set-SPORestrictedSiteCreation

Sets or updates one or more group configurations for restricting site creation.

Syntax

Set-SPORestrictedSiteCreation
     [-Enabled <Boolean>]
     [-Mode <RestrictedSiteCreationMode>]
     [-SiteType <RestrictedSiteCreationSiteType>]
     [-RestrictedSiteCreationGroups <String>]

Description

This cmdlet sets or updates the configuration or setting for the Restricted Site Creation feature.

Important

You must use version 16.0.25513.12000 (published November 2024) or later of the SharePoint Online Management Shell for these commands to function properly. Earlier versions do not have the current list of site types and will not operate correctly.

Examples

Example 1

Set-SPORestrictedSiteCreation -Enabled:$true

Example 1 enables the restricted site creation feature for the tenant.

Example 2

Set-SPORestrictedSiteCreation -Mode Allow

Example 2 sets restricted site creation to allow mode. In this mode, a user is only able to create a site if they are a member of a group specified for a matching site type.

Example 3

Set-SPORestrictedSiteCreation -SiteType "All" -RestrictedSiteCreationGroups "281e395b-7316-4cb2-b5bb-8881426ee411"

Example 3 updates the policy for the All site type to apply to members of the Microsoft Entra security group with ID 281e395b-7316-4cb2-b5bb-8881426ee411. Members of this group are now either allowed or denied (depending on the current mode) from creating all OneDrive and SharePoint sites.

Example 4

Set-SPORestrictedSiteCreation -SiteType "Team" -RestrictedSiteCreationGroups "78159241-04a9-41d2-8dd4-ac568e9766a3,1f95829b-e1c8-4406-b2be-508c36f4bca5"

Example 4 updates the policy for the Team site type to apply to members of the two specified groups. Members of both specified security groups are now either allowed or denied from creating Team sites, depending on the current mode.

Example 5

Set-SPORestrictedSiteCreation -SiteType "OneDrive" -RestrictedSiteCreationGroups ""

Example 5 clears the policy for the OneDrive site type so that it no longer applies to any users.

Parameters

-Enabled

PARAMVALUE: true | false Enables or disables Restricted Site Creation feature in tenant.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Online

-Mode

Specifies whether policies allow or deny users from creating sites. PARAMVALUE: Deny | Allow

  • Deny - a user will be blocked from creating a site if any policy applies to them.
  • Allow - a user will only be allowed to create a site if a policy applies to them.

Note

The restricted site creation mode is shared across all site type policies. It is not possible to use deny mode for one site type and allow mode for a different site type. When the mode is changed, all polices are cleared.

Type:RestrictedSiteCreationMode
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Online

-RestrictedSiteCreationGroups

A comma-separated list of up to 10 Microsoft Entra security group IDs. When paired with the -SiteType parameter, defines a new policy which applies to the specified groups. Set to the empty string ("") to clear the policy for a site type.

Type:String
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Online

-SiteType

When paired with the -RestrictedSiteCreationGroups parameter, creates a new policy which applies to the specified types of sites.

PARAMVALUE: All | SharePoint | OneDrive | Team | Communication

  • All - OneDrive and all SharePoint sites
  • SharePoint - All SharePoint sites (but not OneDrive)
  • OneDrive - Only OneDrive
  • Team - Only SharePoint team sites (group-connected and classic)
  • Communication - Only SharePoint communication sites
Type:RestrictedSiteCreationSiteType
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Online