> Hi -
>
> I'm trying to implement transactionality in my app, so I'm trying to
> rollback a given page in a OneNote Notebook to a previously persisted
> state. In order to do this, (If I understand the API correctly) I
> need to do this in the following way:
>
> 1) prune the page down to a minimum - delete anything with an objectId
> is good enough
> 2) call UpdateHierarchy with my persisted page data - simply updating
> with the persisted data will not remove any objects.
>
> This is how the xml looks for the page, after I've pruned:
> <?xml version="1.0"?>
> <one:Page xmlns:one="
http://schemas.microsoft.com/office/onenote/2007/> onenote" ID="{759AA919-A509-441C-A281-D3822F1478E0}{1}{B0}" name="Page
> 4: " dateTime="2007-06-27T20:49:11.000Z"
> lastModifiedTime="2007-06-27T21:05:09.000Z" isCurrentlyViewed="true">
> <one:Meta name="PageNumber" content="4"/>
> <one:Meta name="NotebookId" content="{75C00C0F-F793-4C29-
> B679-6F3D7C69A7C4}{1}{B0}"/>
> </one:Page>
>
> Looks as expected. Now, I want to update it with the following:
> <?xml version="1.0"?>
> <one:Page xmlns:one="
http://schemas.microsoft.com/office/onenote/2007/> onenote" ID="{759AA919-A509-441C-A281-D3822F1478E0}{1}{B0}" name="Page
> 4: " dateTime="2007-06-27T20:49:11.000Z"
> lastModifiedTime="2007-06-27T21:02:29.000Z" style="font-
> family:Calibri;font-size:11.0pt">
> <one:Meta name="AdapxPageNumber" content="4"/>
> <one:Meta name="AdapxNotebookId" content="{75C00C0F-F793-4C29-
> B679-6F3D7C69A7C4}{1}{B0}"/>
> <one:PageSettings RTL="false" color="automatic">
> <one:PageSize>
> <one:Orientation="" landscape="false"/>
> <one:Dimensions width="419.5199890136719"
> height="595.27001953125"/>
> <one:Margins top="0.0" bottom="0.0" left="0.0" right="0.0"/>
> </one:PageSize>
> <one:RuleLines visible="true">
> <one:Horizontal color="#CAEBFD" spacing="17.89999961853027"/>
> </one:RuleLines>
> </one:PageSettings>
> <one:Title style="font-family:Calibri;font-size:17.0pt" lang="en-
> US">
> <one:OE author="ben.mcallister" lastModifiedBy="ben.mcallister"
> creationTime="2007-06-27T20:49:11.000Z"
> lastModifiedTime="2007-06-27T20:49:11.000Z"
> objectID="{CF8678F0-8F73-4198-91ED-9614F9C14A5A}{31}{B0}"
> alignment="left">
> <one:T>
> <![CDATA[Page 4: ]]>
> </one:T>
> </one:OE>
> </one:Title>
> <one:Image format="png" originalPageNumber="0"
> lastModifiedTime="2007-06-27T20:49:11.000Z"
> objectID="{CF8678F0-8F73-4198-91ED-9614F9C14A5A}{36}{B0}">
> <one:Position x="380.0" y="19.5" z="0"/>
> <one:Size width="13.79999542236328" height="15.60000038146973"/
> >
> <one:Data>[some binary data...]
> </one:Data>
> </one:Image>
> <one:Outline author="ben.mcallister" lastModifiedBy="ben.mcallister"
> lastModifiedTime="2007-06-27T21:02:28.000Z"
> objectID="{60C8AEC5-7E82-4CD6-B43A-5FA0B0E20CFF}{10}{B0}">
> <one:Position x="239.9244079589843" y="375.8999938964844" z="1"/
> >
> <one:Size width="72.0" height="35.80155944824219"/>
> <one:OEChildren>
> <one:OE creationTime="2007-06-27T21:02:28.000Z"
> lastModifiedTime="2007-06-27T21:02:28.000Z"
> objectID="{60C8AEC5-7E82-4CD6-B43A-5FA0B0E20CFF}{11}{B0}"
> alignment="left">
> <one:InkWord recognizedText="X" x="0.0" y="0.0"
> inkOriginX="-239.9244079589843" inkOriginY="-375.9023742675781"
> width="17.68819427490234" height="35.80155944824219">
> <one:Data>
> AMwBHQI0VAFAKgAaH4tCcEWEdYC+0EXZBPqHlTLy7BdBuMAWv/Mr
> 9HpFU4AsehjVRJllSjQGMVsz
> FJVAnpLMmEu1apAcEsVaVQMESBBFNQUCC2UVAACAPwAAgD8AAIA/
> AAAeRGQDFUYAQGYQPoBGEQAA
> M80AAjgAADi8AABKCjawA8AFYBUA8gAATwkEZwMVRgBAChoDh/
> GqZ445+ECAh/KI15LMeIXABRRG
> AIAAAAoeBobxiUeMBO1gIGFAh/KPJ5Pq83zud2EFFEYAQAAA
> </one:Data>
> </one:InkWord>
> </one:OE>
> </one:OEChildren>
> </one:Outline>
> </one:Page>
>
>
> When I try to call UpdateHierarchy with this second chunk of xml,
> OneNote throws a COMFailException:
> Exception from HRESULT: 0x80042000
> at
> Microsoft.Office.Interop.OneNote.ApplicationClass.UpdateHierarchy(String
> bstrChangesXmlIn)
> "XML is not well-formed."
>
> The xml validates against the schema, and came from a call to
> GetPageContent anyway. Any idea what I might be doing wrong?
>
> Thanks,
> Ben McAllister