I have a vb6 application that interacts with OneNote 2010. I am testing the integration in win XP and Win 7. Some notebooks can exist on SkyDrive and those are no problem in either OS, they open via a browser. When creating a new notebook, it is creating it locally. this works fine in XP but calls an error in win 7: "Runtime error "-2147213311 (80042001) M3thod UPdateHierarchy of object IApplication failed" I am interpreting this as a OneNote error which means the XML is invalid. The XML is generated the same way regardless of the OS. Are there any differences with the Microsoft XML libraries between XP and 7? I have not been able to pinpoint what the issue is in win 7, any help would be appreciated. the XML and code follows:
Quincy Mutual Insurance Co. is the new notebook I am trying to create.
Win XP :
<?xml version="1.0"?>
<one:Notebooks xmlns:one="http://schemas.microsoft.com/office/onenote/2010/onenote">
<one:Notebook name="Personal" nickname="Personal" ID="{EB245BB4-63DA-404E-BB9F-447008E7BE52}{1}{B0}" path="https://d.docs.live.net/637f21528f6026bf/^.Documents/Personal/" lastModifiedTime="2012-09-04T20:12:40.000Z" color="#FFD869"/>
<one:Notebook name="EMC Insurance Companies" nickname="EMC Insurance Companies" ID="{DBA316FE-5D42-445E-A356-7405E7DD9E12}{1}{B0}" path="https://d.docs.live.net/637f21528f6026bf/^.Documents/EMC Insurance Companies/" lastModifiedTime="2012-06-29T10:41:29.000Z" color="#9595AA"/>
<one:Notebook name="Sentry Insurance Company" nickname="Sentry Insurance Company" ID="{8A4E905D-429E-491E-9FE5-856A10BE3CD7}{1}{B0}" path="D:\My Documents\OneNote Notebooks\Sentry Insurance Company" lastModifiedTime="2012-08-14T13:15:36.000Z" color="#BA7575"/>
<one:Notebook name="Quincy Mutual Insurance Co" path="D:\My Documents\OneNote Notebooks\\Quincy Mutual Insurance Co"/>
</one:Notebooks>
Windows 7
<?xml version="1.0"?>
<one:Notebooks xmlns:one="http://schemas.microsoft.com/office/onenote/2010/onenote">
<one:Notebook name="EMC Insurance Companies" nickname="EMC Insurance Companies" ID="{E68066FB-38A4-4190-B82F-0A9F322C29AF}{1}{B0}" path="https://d.docs.live.net/637f21528f6026bf/Documents/EMC Insurance Companies/" lastModifiedTime="2012-08-24T22:07:44.000Z" color="#9595AA"/>
<one:UnfiledNotes ID="{C8E287E1-3EF2-464B-9ACB-F22B69A887A5}{1}{B0}"/>
<one:Notebook name="Quincy Mutual Insurance Co" path="G:\Users\ROC\Documents\OneNote Notebooks\\Quincy Mutual Insurance Co"/>
</one:Notebooks>
-
Private Function GetClientOneNoteNotebookNode(oneNote As OneNote14.Application, ClientName As String) As MSXML2.IXMLDOMNodeList
' Get the XML that represents the OneNote notebooks available.
Dim notebookXml As String
Dim doc As MSXML2.DOMDocument
Dim elem As MSXML2.IXMLDOMElement
Dim newNotebookPath As String
Dim notebookNodeList As MSXML2.IXMLDOMNodeList
Dim node As MSXML2.IXMLDOMNode
Dim defaultNotebookFolder As String
' OneNote fills notebookXml with an XML document providing information
' about what OneNote notebooks are available.
' You want all the data and thus are providing an empty string
' for the bstrStartNodeID parameter.
oneNote.GetHierarchy "", hsNotebooks, notebookXml, xs2010
' Use the MSXML Library to parse the XML.
Set doc = New MSXML2.DOMDocument
If doc.loadXML(notebookXml) Then
Set notebookNodeList = doc.documentElement.selectNodes("//one:Notebook[@name='" & ClientName & "']")
If notebookNodeList.Length = 0 Then
'Get the default location for the notebooks
oneNote.GetSpecialLocation slDefaultNotebookFolder, defaultNotebookFolder
newNotebookPath = defaultNotebookFolder + "\\" + ClientName
' Dim notebookId As String
' notebookId = doc.Attributes.getNamedItem("id").Text
'Create new notebook for cleint
Set elem = doc.createElement("one:Notebook")
elem.setAttribute "name", ClientName
elem.setAttribute "path", newNotebookPath
' add new elelement to the document tree
doc.documentElement.appendChild elem
' Set notebookNodeList = doc.documentElement.selectNodes("//one:Notebook [@name='Personal']")
' elem.setAttribute "path", defaultNotebookFolder
oneNote.UpdateHierarchy doc.XML
End If
' Close notebook
' oneNote.CloseNotebook notebookId, False
' ' Open notebook
' oneNote.OpenHierarchy newNotebookPath, "", notebookId, cftNone
Set GetClientOneNoteNotebookNode = notebookNodeList
Else
Set GetClientOneNoteNotebookNode = Nothing
End If
End Function
Anyone have any ideas? or can anyone point me to a ressource? Thanks for any help!