Blog about anything related to my learnings
  • About
  • posts
bluesky
Blog about anything related to my learnings
POSTS

#https://reshmee.sharepoint.com/sites/ContosoIT/_api/Microsoft.Sharepoint.Utilities.WebTemplateExtensions.SiteScriptUtility.ApplyListDesign()

#{“listDesignId”:“7fdc8cba-3e07-4851-a7ac-b747040ff1ce”,“store”:1,“runtimeParameters”:"{"MediaLibrary_listName":"Media library","MediaLibrary_description":"","MediaLibrary_color":10,"MediaLibrary_addNavLink":true,"MediaLibrary_icon":5}"}

$SiteUrl = “https://reshmee.sharepoint.com/sites/ContosoIT" $ClientId = “f7fd5547-3751-4da4-89f8-25ebe1f6add1” # Entra app client id $Method = “POST” # GET, POST, PATCH, DELETE $Endpoint = “_api/Microsoft.Sharepoint.Utilities.WebTemplateExtensions.SiteScriptUtility.ApplyListDesign()”

$listName_FieldValue = “MediaLibrary_listName” $listDesignId = “7fdc8cba-3e07-4851-a7ac-b747040ff1ce” # Media Library list design ID $listName = “Media Lib”

For POST/PATCH, set a body object. Keep $BodyObject = $null for GET.

$BodyObject = @{ listDesignId = $listDesignId store = 1 runtimeParameters = “{"$listName_FieldValue”:"$listName”}" }

=========================

Connect with PnP

=========================

Connect-PnPOnline -Url $SiteUrl -ClientId $ClientId -interactive

$Uri = “$SiteUrl/$Endpoint”

Convert body only when provided

if ($null -ne $BodyObject) {

$BodyJson = $BodyObject | ConvertTo-Json -Depth 10

$Response = Invoke-PnPSPRestMethod -Method $Method -Url $Uri -Content $BodyObject

} else { $Response = Invoke-PnPSPRestMethod -Method $Method -Url $Uri }

Output

$Response | ConvertTo-Json -Depth 10

    © Blog about anything related to my learnings 2026
    bluesky