我有一个与 OneNote 2010 交互的 vb6 应用程序。我正在测试 win XP 和 Win 7 中的集成。一些笔记本可以存在于 SkyDrive 上,并且在任何一个操作系统中都没有问题,它们通过浏览器打开。创建新笔记本时,它是在本地创建它。这在 XP 中工作正常,但在 win 7 中调用错误:“运行时错误”-2147213311(80042001)对象 IApplication 的 M3thod UPdateHierarchy 失败”我将此解释为 OneNote 错误,这意味着 XML 无效。生成的 XML 相同无论操作系统如何. XP 和 7 之间的 Microsoft XML 库有什么区别吗? 我无法确定 win 7 中的问题, 任何帮助将不胜感激. XML 和代码如下:
Quincy Mutual Insurance Co. 是我正在尝试创建的新笔记本。
赢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
有人有想法么?或者任何人都可以指出我的资源?谢谢你的帮助!