Adding a new Notebook with UpdateHierarchy - OneNote 2007 API

B

benmca

Hi - I'm trying to add a new notebook in OneNote 2007 using
UpdateHierarchy, and am having trouble. I have tried to send the
following xml fragments in to the UpdateHierarchy method:

Frag 1:

<one:Notebook xmlns:eek:ne="http://schemas.microsoft.com/office/onenote/
2007/onenote" nickname="NicknametestNotebook" ID="{0B8E7305-
AC2C-4BCB-8651-1CDA55AAE14C}{1}{B0}" name="testNotebook"
lastModifiedTime="2007-03-26T09:43:37.5000000-07:00" />

Frag 2:

<one:Notebooks xmlns:eek:ne="http://schemas.microsoft.com/office/onenote/
2007/onenote">
<one:Notebook xmlns:eek:ne="http://schemas.microsoft.com/office/onenote/
2007/onenote" nickname="NicknametestNotebook" ID="{0B8E7305-
AC2C-4BCB-8651-1CDA55AAE14C}{1}{B0}" name="testNotebook"
lastModifiedTime="2007-03-26T09:43:37.5000000-07:00" />
</one:Notebooks>

Frag 3:
<one:Notebook xmlns:eek:ne="http://schemas.microsoft.com/office/onenote/
2007/onenote" nickname="NicknametestNotebook" name="testNotebook"
lastModifiedTime="2007-03-26T09:43:37.5000000-07:00" />

Frag 4:
<one:Notebooks xmlns:eek:ne="http://schemas.microsoft.com/office/onenote/
2007/onenote">
<one:Notebook xmlns:eek:ne="http://schemas.microsoft.com/office/onenote/
2007/onenote" nickname="NicknametestNotebook" name="testNotebook"
lastModifiedTime="2007-03-26T09:43:37.5000000-07:00" />
</one:Notebooks>

and all return hrNotebookDoesNotExist (0x80042015). Can anyone offer
advice here? I need to programatically add a new notebook,
specifiying it's name and, preferably, it's ID.


Thanks in advance,
Ben
 
I

Ilya Koulchin

Hi - I'm trying to add a new notebook in OneNote 2007 using
UpdateHierarchy, and am having trouble. I have tried to send the
following xml fragments in to the UpdateHierarchy method:

You need to tell OneNote where the notebook you're trying to open is
located in the filesystem. Without you providing the path to the
notebook, OneNote is unable to determine where it should be located, and
will be unable to open it.
I need to programatically add a new notebook,
specifiying it's name and, preferably, it's ID.

Is there a particular reason you want a specific ID?

Ilya
 
B

benmca

Thank you for the hint, Ilya - for anyone else curious, here's my
code:

<snip>
string nbName = "name of notebook";
string specialLocationPath;

_app.GetSpecialLocation(SpecialLocation.slDefaultNotebookFolder, out
specialLocationPath);

string newNotebookPath = specialLocationPath + "\\" +
nbName;

string objId;
_app.OpenHierarchy(newNotebookPath, "", out objId,
CreateFileType.cftNotebook);
</snip>

I was going to squirrel away data within the Notebook Id that would be
global to the notebook. If there were Metadata at this level (if
Notebook had a sequence of type Meta) that would work, but there is
not.
b
 
D

Daniel Escapa [MS]

We don't have one, please just use this newsgroup.

If the volume gets high we can look into some other solution.
 

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