You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for applying built-in Microsoft site designs (store 1) (#5358)
The existing Get-PnPSiteDesign and Invoke-PnPSiteDesign cmdlets used CSOM
(Tenant.GetSiteDesigns / Tenant.ApplySiteDesign) which only works for
tenant-registered custom designs (store 0). Microsoft's built-in site
designs such as Event, Department and Human Resources live in the SharePoint
site template store (store 1) and require the SiteScriptUtility REST API
with a store parameter — there was no way to reach them from PnP PowerShell.
- Add Get-PnPSiteDesign -BuiltIn switch: calls SiteScriptUtility.GetSiteDesigns
with store 1 and returns BuiltInSiteDesign objects (Id, Title, Template enum)
- Add Invoke-PnPSiteDesign -Template <BuiltInSiteTemplates>: resolves the GUID
from the existing BuiltInSiteTemplates enum mapping and calls
SiteScriptUtility.ApplySiteDesign with store 1
- Add BuiltInSiteDesign model class for deserialising the REST response
- Add GetBuiltInSiteDesigns and ApplyBuiltInSiteDesign utility methods to
SiteTemplates.cs so the REST logic is centralised
- Fix missing DefaultParameterSetName on Get-PnPSiteDesign to prevent
ambiguous parameter set error when called without arguments
- Update documentation for both cmdlets with new syntax, parameter descriptions
and usage examples
Co-authored-by: Gautam Sheth <gautamdsheth@outlook.com>
Retrieve Site Designs that have been registered on the current tenant. When providing a name with -Identity, it returns all site designs with that name.
29
37
38
+
Use the -BuiltIn switch to instead return the built-in Microsoft site designs (e.g. Event, Department, Human Resources) which are available from the SharePoint site template store.
When specified, returns the built-in Microsoft site designs from the SharePoint site template store (store 1) instead of tenant-registered designs.
88
+
89
+
```yaml
90
+
Type: SwitchParameter
91
+
Parameter Sets: BuiltIn
92
+
93
+
Required: True
94
+
Position: Named
95
+
Default value: None
96
+
Accept pipeline input: False
97
+
Accept wildcard characters: False
98
+
```
99
+
62
100
### -Connection
63
101
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.
Applies the Site Design provided through Identity to an existing site. When providing a site design name and multiple site designs exist with the same name, all of them will be invoked.
33
+
Applies a Site Design to an existing site.
34
+
35
+
Use `-Identity` to apply a tenant-registered site design by Id or name. When a name matches multiple designs, all of them will be invoked.
36
+
37
+
Use `-Template` to apply one of the built-in Microsoft site designs (e.g. Event, Department, Human Resources) directly by name, without needing to look up the design Id first. This calls the SharePoint SiteScriptUtility REST API against the built-in template store (store 1).
25
38
26
39
## EXAMPLES
27
40
@@ -44,30 +57,30 @@ Applies the specified site design to the specified site.
Applies the specified site design to the specified site.
48
-
49
-
## PARAMETERS
60
+
Applies the site design named "Demo" to the current site via the pipeline.
50
61
51
-
### -Connection
52
-
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.
The name of a built-in Microsoft site design to apply. Uses the SharePoint SiteScriptUtility REST API against the built-in template store (store 1). Cannot be combined with -Identity.
79
94
95
+
```yaml
96
+
Type: BuiltInSiteTemplates
97
+
Parameter Sets: By Built-in Template
98
+
99
+
Required: True
100
+
Position: Named
101
+
Default value: None
102
+
Accept pipeline input: False
103
+
Accept wildcard characters: False
104
+
```
80
105
81
106
### -WebUrl
82
107
The URL of the web to apply the site design to. If not specified it will default to the current web based upon the URL specified with Connect-PnPOnline.
@@ -92,7 +117,20 @@ Accept pipeline input: False
92
117
Accept wildcard characters: False
93
118
```
94
119
120
+
### -Connection
121
+
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.
122
+
123
+
```yaml
124
+
Type: PnPConnection
125
+
Parameter Sets: (All)
126
+
127
+
Required: False
128
+
Position: Named
129
+
Default value: None
130
+
Accept pipeline input: False
131
+
Accept wildcard characters: False
132
+
```
133
+
95
134
## RELATED LINKS
96
135
97
136
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
0 commit comments