2012-09-05 107 views
1

我有一個與OneNote 2010交互的vb6應用程序。我正在測試win XP和Win 7中的集成。一些筆記本可以存在於SkyDrive上,並且這些在任一操作系統中都沒有問題,它們通過瀏覽器。創建新筆記本時,它將在本地創建它。這在XP中正常工作,但在win 7中調用錯誤: 「運行時錯誤」-2147213311(80042001)M3thod對象IApplication的UPdateHierarchy失敗「 我將其解釋爲OneNote錯誤,這意味着XML無效。不管操作系統如何,都是一樣的,在XP和7之間,微軟的XML庫有什麼不同嗎?我一直無法確定win 7中的問題,希望得到任何幫助,XML和代碼如下:VB 6與OneNote的集成

昆西互助保險有限公司是新的筆記本電腦,我想創建

的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 

人有什麼想法?或者任何人都可以指向我的資源?謝謝你的幫助!

回答

0

我想開在OneNote 2013的OneNote筆記本將更改架構,我正面臨着類似的問題,我的自定義插件

您可以嘗試以下操作:

  1. 打開麻煩的筆記本電腦在2010年桌面的OneNote

  2. 保存筆記本作爲.onepkg歸檔文件

  3. 拆開.onepkg檔案某處提交您的PC

  4. 打開解壓後的筆記本在桌面上的OneNote 2010

編號:http://www.mobilenoter.com/blog/post/2012/08/13/MobileNoter-SE-OneNote-2013-Preview-issues.aspx

+1

感謝您的回覆,我在您提供的鏈接中閱讀了相關信息。似乎對2013版本更具體,並在該版本中打開現有的筆記本電腦。我的問題與初始創建新筆記本(本地)有關。我用於XP和Win 7的OneNote版本是2010年。 – roc

0

我注意到,對於XP的路徑中有空格和WIN7沒有空格。這可能是罪魁禍首嗎? 另外,你的路徑中沒有雙打,你只有一個斜線。也許就是這樣?