我想弄清楚如何在 OneNote 2010 中添加笔记本。我找不到任何代码示例来显示如何使用 UpdateHiarchy API 添加新笔记本。我正在尝试从 VB6 应用程序中执行此操作。我是从 VB 使用 xml 的新手。代码如下:
Private Function GetFirstOneNoteNotebookNodes(oneNote As OneNote14.Application) As MSXML2.IXMLDOMNodeList
' Get the XML that represents the OneNote notebooks available.
Dim notebookXml 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.
Dim doc As MSXML2.DOMDocument
Set doc = New MSXML2.DOMDocument
Dim elem As MSXML2.IXMLDOMElement
If doc.loadXML(notebookXml) Then
' Here is search for a notebook that i know is not there. mvarpAssignment.pClient.Name is a program variable that contains a text name.
Set GetFirstOneNoteNotebookNodes = doc.documentElement.selectNodes("//one:Notebook[@name='" & mvarpAssignment.pClient.Name & "']")
' I test the length for zero to see if anything was returned:
If GetFirstOneNoteNotebookNodes.Length = 0 Then
' I want to create a notebook, so i beleive i need to add an element to the xml returned from the GetHiearchy API:
Set elem = doc.createElement("ROC")
doc.documentElement.appendChild elem
'I print out the xml and i can see the element added at the end of the xml document.
Debug.Print doc.XML
' 下一步是调用 UpdateHiarchy API,但我不知道我将哪个对象传递给 API。我尝试的一切都失败了。我显然对此理解不够,但我找不到任何代码示例或任何描述如何添加笔记本的文本。任何帮助或任何信息链接将不胜感激!