SharePoint / SharePoint/sp-dev-docs

ContentTypeBinding is not accepted as a child of elements

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

@Ashlesha-MSFT is already working on this.

Since Apr 18, 2025.

Needs: Author Feedback Needs: Triage :mag: sharepoint-developer-support 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?

💥 SharePoint Framework

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

sharepoint online
spfx 1.19.0

Describe the bug / error

this page
https://learn.microsoft.com/en-us/sharepoint/dev/schema/content-type-bindings
specifies the scheme for content type bindings.
however, when I use the sample provided and upload a package to SharePoint online (o365) I get the error

There were problems with the app web definition in the package.Details: Deployment failed in host web https://hideandseekdigital.sharepoint.com/sites/AFP-Integration for app AFP Intranet App Customiser/1bd5c67d-11c2-4372-8c72-9569b23ecb5e. Microsoft.SharePoint.SPException: Feature definition with Id 4036bacc-c5f3-4741-9f4f-af533d3678ae failed validation, file '/4036bacc-c5f3-4741-9f4f-af533d3678ae/AppSettingsLists.xml', line 11, character 6: The element 'Elements' in namespace 'http://schemas.microsoft.com/sharepoint/' has invalid child element 'ContentTypeBinding' in namespace 'http://schemas.microsoft.com/sharepoint/'. List of possible elements expected: 'CustomAction, ClientWebPart, ClientSideComponent, ClientSideComponentInstance, Field, ContentType, ListInstance, Module, PropertyBag' in namespace 'http://schemas.microsoft.com/sharepoint/'. at Microsoft.SharePoint.Administration.SPSolutionPackage.FeatureXmlValidationCallback.XmlValidationCallBack(Object sender, ValidationEventArgs evtargs) at System.Xml.Schema.XmlSchemaValidator.ValidateElementContext(XmlQualifiedName elementName, Boolean& invalidElementInContext) at System.Xml.Schema.XmlSchemaValidator.ValidateElement(String localName, String namespaceUri, XmlSchemaInfo schemaInfo, String xsiType, String xsiNil, String xsiSchemaLocation, String xsiNoNamespaceSchemaLocation) at System.Xml.XsdValidatingReader.ProcessElementEvent() at System.Xml.XsdValidatingReader.Read() at System.Xml.XmlReader.MoveToContent() at System.Xml.XmlReader.IsStartElement() at Microsoft.SharePoint.Utilities.SPUtility.XsdValidateXml(XmlTextReader xmlStreamReader, String friendlyName, String pathXsdFile, String tagExpectedRootNode, Int32 desiredPathVersion, ValidationEventHandler xsdValEventHandler) at Microsoft.SharePoint.Packaging.SPTargetWebDeploymentGroup.ValidateAppPartFeatureXsd(PackagePart appPart, Guid featureGuid) at Microsoft.SharePoint.Packaging.SPTargetWebDeploymentGroup.ExtractElementPartToWsp(PackagePart elementPart, TemporaryDirectory wspTempDir, SHA256Managed sha, Guid productId, SPAppInstance appInstance, Guid featureId, String featureWspRelativeDirectory) at Microsoft.SharePoint.Packaging.SPTargetWebDeploymentGroup.ExtractFeaturePartToWsp(SPFeatureAppPart featureAppPart, TemporaryDirectory wspTempDir, SHA256Managed sha, Guid productId, SPAppInstance appInstance) at Microsoft.SharePoint.Packaging.SPTargetWebDeploymentGroup.ExtractFeaturePartsToWsp(List1 featureAppParts, SPWeb web, TemporaryDirectory wspTempDir, SHA256Managed sha, Guid productId) at Microsoft.SharePoint.Packaging.SPTargetWebDeploymentGroup.GenerateAndActivateUserSolutionFromPackage(SPWeb web, SPAppPackage appPackage, Guid productId, String solutionName, SPSolutionLevel solutionLevel) at Microsoft.SharePoint.Packaging.SPTargetWebDeploymentGroup.InstallOrUpgrade(SPSite site, Nullable1& solutionId, Boolean& swapNeeded)

Steps to reproduce
  1. create a SPFX project (in my case an extension)
  2. add xml asset to bind a content type to a list. make sure the ContentTypeId is a valid one and the list exists in the specified listurl
  3. package and upload to site, try to add app to site
Expected behavior

Either

  1. the documentation is wrong and does not apply to sharepoint online anymore - in which case update it!
  2. there is a bug that sharepoint online does not recognise the schema it should

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.