Microsoft.Office.Interop.OneNote - Exception from HRESULT: 0x80042

B

b0lt

I'm trying to import files generated by the G-Note 7100 digital tablet (I'm a
poor college student that can't afford a tablet PC) into OneNote 2007 using
the .NET Office Interop API. I converted the file into a StrokeCollection and
saved it as an ISF file, but when I try to import the ISF into OneNote, I get
hrInvalidXML. I uploaded a copy of the code I'm using at
http://pastebin.com/f54a9f712

If anyone can help me figure out what I'm doing wrong, I'd greatly
appreciate it.
Thanks!
 
I

Ilya Koulchin

b0lt said:
I'm trying to import files generated by the G-Note 7100 digital tablet (I'm a
poor college student that can't afford a tablet PC) into OneNote 2007 using
the .NET Office Interop API. I converted the file into a StrokeCollection and
saved it as an ISF file, but when I try to import the ISF into OneNote, I get
hrInvalidXML. I uploaded a copy of the code I'm using at
http://pastebin.com/f54a9f712

{0} is not a valid page ID. If you're trying to import into an existing
page, you need to use the ID that is returned by GetHierarchy or
GetContent. If you're trying to import into a new page, you will first
need to call CreatePage and then use the ID returned by that API.
(followup-to set to microsoft.public.onenote)

Ilya
 
B

b0lt

Ilya Koulchin said:
{0} is not a valid page ID. If you're trying to import into an existing
page, you need to use the ID that is returned by GetHierarchy or
GetContent. If you're trying to import into a new page, you will first
need to call CreatePage and then use the ID returned by that API.
(followup-to set to microsoft.public.onenote)

Ilya

I used string.Format to insert the page ID I got from
Application.CreateNewPage, shouldn't that work?
 
I

Ilya Koulchin

b0lt said:
I used string.Format to insert the page ID I got from
Application.CreateNewPage, shouldn't that work?

Yes, you did indeed. My apologies, I must've missed that part. Have you
run the fully formatted XML through an XML validator?

Ilya
 
B

b0lt

Ilya Koulchin said:
Yes, you did indeed. My apologies, I must've missed that part. Have you
run the fully formatted XML through an XML validator?

Ilya

Yeah, I'm getting "Error: Can not find declaration of element 'one:page'."
on the first line, which makes no sense to me. I'm not understanding why this
is happening, since the format I'm using is pretty much copy/pasted from
Microsoft's schema.
 
I

Ilya Koulchin

b0lt said:
Yeah, I'm getting "Error: Can not find declaration of element 'one:page'."
on the first line, which makes no sense to me. I'm not understanding why this
is happening, since the format I'm using is pretty much copy/pasted from
Microsoft's schema.

I think you're missing the XML declaration. Try adding "<?xml
version="1.0"?>" as the first line.

Ilya
 
B

b0lt

Ilya Koulchin said:
I think you're missing the XML declaration. Try adding "<?xml
version="1.0"?>" as the first line.

Ilya

Adding the XML declaration in the first line resulted in the same thing for
both Office Interop and the XML validator I was using. Could the error be
caused by the validator not supporting XSD?
 

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