I am trying to create a table in a new page on OneNote via the COM API. It's coming back with invalid XML but I can't figure out why... I'd appreciate any expert help :)
I'm getting the following error:
Exception from HRESULT: 0x80042001
When running this code:
static string CreatePage(string sectionId, string pageName)
{
// Create the new page
string pageId;
onenoteApp.CreateNewPage(sectionId, out pageId, NewPageStyle.npsBlankPageWithTitle);
var doc = CreateTable();
// Update the page
onenoteApp.UpdatePageContent(doc.ToString());
return pageId;
}
The error lokup comes back with:
hrInvalidXML
0x80042001
The XML is invalid.
Both the XML examples below fail...
Here's some cut down XML I'm loading:
<Page> <Outline> <OEChildren> <OE> <T><![CDATA[test 2-3 ]]></T> </OE> </OEChildren> </Outline></Page>
Here's the main XML
<Page xmlns="http://schemas.microsoft.com/office/onenote/2010/onenote">
<Outline>
<OEChildren>
<OE>
<Table>
<Columns>
<Column />
<Column />
<Column />
</Columns>
<Row>
<Cell>
<OEChildren>
<OE>
<T><![CDATA[test 1-1 ]]></T>
</OE>
</OEChildren>
</Cell>
<Cell>
<OEChildren>
<OE>
<T><![CDATA[test 1-2 ]]></T>
</OE>
</OEChildren>
</Cell>
<Cell>
<OEChildren>
<OE>
<T><![CDATA[test 1-3 ]]></T>
</OE>
</OEChildren>
</Cell>
</Row>
<Row>
<Cell>
<OEChildren>
<OE>
<T><![CDATA[test 2-1 ]]></T>
</OE>
</OEChildren>
</Cell>
<Cell>
<OEChildren>
<OE>
<T><![CDATA[test 2-2 ]]></T>
</OE>
</OEChildren>
</Cell>
<Cell>
<OEChildren>
<OE>
<T><![CDATA[test 2-3 ]]></T>
</OE>
</OEChildren>
</Cell>
</Row>
</Table>
</OE>
</OEChildren>
</Outline>
</Page>