OneNote Addin - Save and reload page - UpdatePageContent

H

Herthoren

Hi!

I've been searching for days to find a solution for my problem, but couldn't
find anything that got me through this.
I want to make some little changes to a OneNote page from an add-in I write
(Just replace certain strings with certain symbols - some latex-like
rendering).
I can't even reload a previously saved page's unchanged code in any way.

What I do is getting the page's code with the GetPageContent method, then
try to reload it with the UpdatePageContent method.

If i just upload it without any change it throws
hrInvalidXML 0x80042001 exception


If I remove all objectID's from it (keeping only the page's ID) it throws
hrInsertingInk 0x80042008 exception

If I also remove all InkDrawing and InkWord objects it throws
hrInvalidXML 0x80042001 exception again.

Can't find a working example of how to save a page and reload it back.
Could anyone tell me why this doesn't work? As far as I understood it, the
UpdatePageConent form is the same as I get from GetPageContent, except for
the mess with the IDs, which I correctly removed.

Thank you very much
 
I

Ilya Koulchin

Herthoren said:
What I do is getting the page's code with the GetPageContent method, then
try to reload it with the UpdatePageContent method.

If i just upload it without any change it throws
hrInvalidXML 0x80042001 exception

First, run the XML you're sending to OneNote through an XML validator
(including schema validation) and fix any errors that it reports. If
that still results in hrInvalidXML, it would be helpful if you could
post a sample of the XML that you're trying to import.

Ilya
 
H

Herthoren

Well, I am ashamed.
Left the program rest for a few days now retried to validate the xml code I
tried to use, it validated shamelessly, so I wanted to post it here, just hit
continue on the last breakpoint... and the exception wasn't raised now. I
really got no clue what could have been wrong in the past cause I didn't even
change anything, possibly restarting windows solved the problem (it did when
I was trying to get my addin actually load in) or I just really overlooked
something, no idea.

Thank you very much anyways for your answer, if I didn't get it I would not
have tried to run the same code again. I would say next time I will try it
harder before posting a question, but I seriously feel this time I pushed
just hard enough before asking it anywhere.
Still very confused about what could have been wrong.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top