microsoft/ailab · error · NotSupportedException

The only supported xmlSchema is

Error message

The only supported xmlSchema is {0}

What it means

OneNoteXmlDoc is built exclusively for the OneNote 2013 XML schema (xs2013, namespace http://schemas.microsoft.com/office/onenote/2013/onenote, fixed at compile time); this generic validation guard throws when code attempts to use the document with any other schema value. The invalid input is the schema argument/derived XML that is not xs2013 — e.g. hierarchy or page XML obtained from an older OneNote interop schema.

Solutions

  1. Ensure the OneNote interop/window is created with XMLSchema.xs2013 before requesting XML from OneNote
  2. Convert or re-fetch hierarchy/page XML using the 2013 schema if a legacy schema version was used
  3. Do not pass a schema parameter that differs from the class-level _oneNoteXmlSchema constant
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at Snip-Insights/SnipInsight/SendTo/OneNoteManager.cs:402 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/ailab@89fe2fc620 (2026-09-13). Data as JSON: /api/errors/ef69e354ec76b7e4. Report an issue: GitHub.

Appendix: source

Thrown at Snip-Insights/SnipInsight/SendTo/OneNoteManager.cs:402

    internal class OneNoteXmlDoc
    {
        const OneNote.XMLSchema _oneNoteXmlSchema = OneNote.XMLSchema.xs2013;
        XmlDocument _xmlDoc;
        XmlNamespaceManager _namespaceMgr;
        static readonly string NamespaceUri = "http://schemas.microsoft.com/office/onenote/2013/onenote";
        static readonly string NamespacePrefix = "one";
        static readonly string SectionNodeName = string.Format("{0}:Section", NamespacePrefix);
        static readonly string PageNodeName = string.Format("{0}:Page", NamespacePrefix);
        static readonly string OutlineNodeName = string.Format("{0}:Outline", NamespacePrefix);
        static readonly string SectionNodeXPath = string.Format("//{0}", SectionNodeName);
        static readonly string PageNodeXPath = string.Format("//{0}", PageNodeName);
        static readonly string OutlineNodeXPath = string.Format("//{0}/{1}", PageNodeName, OutlineNodeName);

        internal OneNoteXmlDoc(OneNote.XMLSchema xmlSchema)
        {
            if (xmlSchema != _oneNoteXmlSchema)
            {
                throw new NotSupportedException(string.Format("The only supported xmlSchema is {0}", _oneNoteXmlSchema));
            }

            _xmlDoc = new XmlDocument();

            _namespaceMgr = new XmlNamespaceManager(_xmlDoc.NameTable);
            _namespaceMgr.AddNamespace(NamespacePrefix, NamespaceUri);
        }

         internal OneNoteEntity GetEntity(string hierarchyXml)
        {
            _xmlDoc.LoadXml(hierarchyXml);

            XmlElement rootNode = _xmlDoc.DocumentElement;

            OneNoteEntity entity = GetEntity(rootNode);

            if (string.Compare(rootNode.Name, SectionNodeName, true) == 0)
            {

View on GitHub (pinned to 89fe2fc620)