Here's an interesting little "gotcha" that was found by Saul Candib, the programmer-writer who is taking over documenting OneNote programming features, now that I've moved over to
Using my article Importing Content into OneNote 2003 SP1 as a guide, Saul wrote some code that imported content into OneNote. The code seemed to work fine: OneNote would create the page the user specified, and import the specified content no problem.
Except, once you closed OneNote, when you opened it again the page and all its contents were gone.
Turns out Saul wasn't specifying the '.one' file extension for the page. So the import routine worked perfectly; OneNote created the page and imported the content. You could even go in and add or edit the content on the new page, whatever you wanted. OneNote actually was saving the page in the My Notebooks folder, but without an extension. So the next time you launched OneNote, it saw the imported page as an unknown file and so didn't load it.
All of this was news to me. In my XML examples in the article, I used the .one file extension. For example:
But I never specifically called out that this was a requirement; to be honest, I don’t remember if I ever realized it was a requirement. I certainly never experimented with what happened if I didn't specify the file extension.
What's worse, in my example in the article, I wrote a really basic application that let the user enter the name of the page they wanted to create. But I didn't write any code that checked the specified page name to make sure it contained the file extension, or add the extension if the page name didn't. Shame on me.