Skip to content

AddContentType verb in sitescript fails silently #10429

@fannazephyr

Description

@fannazephyr

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.

Metadata

Metadata

Assignees

Labels

area:site-designCategory: Site Designs/Site Scriptssharepoint-developer-supportsharepoint-developer-supporttype:bug-confirmedConfirmed bug, not working as designed / expected.type:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions