SharePoint / SharePoint/sp-dev-docs

AddContentType verb in sitescript fails silently

Open
#10,429 5 comments 0 reactions 1 assignee View on GitHub

@Ashlesha-MSFT is already working on this.

Since Oct 6, 2025.

area:site-design sharepoint-developer-support type:bug-confirmed type:bug-suspected
Dominant language
PowerShell
Stars
1.4k
Forks
1.1k
Avg merge
4d 12h
Merged PRs (30d)
12

Description

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

Site designs & site scripts

Developer environment

Windows

What browser(s) / client(s) have you tested
  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)
Additional environment details

-NA

Describe the bug / error

I'm using the addContentType verb inside the subactions of a createSPList action in a SharePoint site script to add a custom content type to a newly created document library. The content type already exists in the site collection. Here's the structure:

json
{
"verb": "createSPList",
"listName": "ProjectDocs",
"templateType": 101,
"subactions": [
{
"verb": "addContentType",
"name": "Project Document"
}
]
}
The list is created successfully, but the content type is not added. There are no errors, and the action fails silently. I suspect this is due to a timing issue, where the list is not fully provisioned or content types are not yet enabled when the addContentType action runs.

Steps to reproduce

1.Create a site script like above to create a new library and add content types to it
2.Register the site design with a hub site.
3.Associate another site with hub and the site template is applied.
4. The library is created but content type is not added in the library.

Expected behavior

The content type should be added to the list as part of the site script execution.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.