Skip to content

Adds support for applying built-in Microsoft site designs (store 1). Closes #7460#7461

Open
fabianhutzli wants to merge 1 commit into
pnp:mainfrom
fabianhutzli:feature/spo-sitedesign-builtin-templates
Open

Adds support for applying built-in Microsoft site designs (store 1). Closes #7460#7461
fabianhutzli wants to merge 1 commit into
pnp:mainfrom
fabianhutzli:feature/spo-sitedesign-builtin-templates

Conversation

@fabianhutzli

Copy link
Copy Markdown

Type

  • Bug Fix
  • New Feature
  • Sample

Summary

Closes #7460

Adds support for Microsoft's built-in SharePoint site designs (the "store 1" designs) to spo sitedesign apply, spo sitedesign get and spo sitedesign list. Previously, these commands only reached tenant-registered custom designs (store 0) via the SiteScriptUtility REST API. Built-in Microsoft site templates such as Event, Department and Human Resources live in a separate store and could only be reached by adding "store": 1 to the same REST calls — making them inaccessible from the CLI without a raw m365 request call.

This mirrors the equivalent feature already shipped in PnP PowerShell: pnp/powershell#5358

Modified commands

spo sitedesign list

  • New -b, --builtIn switch. When specified, calls SiteScriptUtility.GetSiteDesigns with store: 1 and returns all built-in Microsoft site designs, enriched with a Template property containing the matching friendly template name.
  • Existing default behaviour (listing tenant-custom designs) is unchanged.

spo sitedesign get

  • New -b, --builtIn switch. When specified, resolves a single built-in design by --id or --title from the store 1 list (rather than GetSiteDesignMetadata, which only supports store 0), enriched with the same Template property.
  • Existing default behaviour is unchanged.

spo sitedesign apply

  • New --template <template> option (mutually exclusive with --id). Resolves the GUID from a static mapping of built-in Microsoft site design names and calls SiteScriptUtility.ApplySiteDesign with store: 1.
  • New -b, --builtIn switch, usable together with --id, for applying a built-in design when you already know its GUID.
  • --asTask is rejected when combined with --builtIn/--template, since the built-in store has no AddSiteDesignTask equivalent.
  • Existing --id-only behaviour (custom designs, store 0) is unchanged.

Implementation notes

  • Added src/m365/spo/commands/sitedesign/BuiltInSiteDesigns.ts, a GUID-to-name mapping for all built-in Microsoft site design templates, ported from PnP PowerShell's BuiltInSiteTemplateSettings so both tools expose the same friendly names.
  • Documentation included (.mdx help pages updated with new options, examples and response shapes for the built-in case).
  • Developed with AI assistance
  • Tested

spo sitedesign list/get/apply only reached tenant-registered custom
site designs (store 0) via the SiteScriptUtility REST API. Microsoft's
built-in designs (Event, Department, Human Resources, etc.) live in
the site template store (store 1) and require passing a store
parameter, mirroring the approach recently added to PnP PowerShell's
Get-PnPSiteDesign -BuiltIn and Invoke-PnPSiteDesign -Template
(pnp/powershell#5358).

- spo sitedesign list --builtIn lists the store 1 designs
- spo sitedesign get --builtIn resolves a single one by id or title
- spo sitedesign apply --template <name> or --id --builtIn applies a
  built-in design; --asTask is rejected in that case as unsupported
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: Add support for built-in Microsoft site designs (store 1) to spo sitedesign commands

1 participant