SjoerdV / ConvertOneNote2MarkDown

Ready to make the step to Markdown and saying farewell to your OneNote, EverNote or whatever proprietary note taking tool you are using? Nothing beats clear text, right? Read on!
GNU General Public License v3.0
196 stars 113 forks source link

Exception calling "GetHierarchy" with "3" argument(s) #20

Closed BoltCitizen closed 2 years ago

BoltCitizen commented 2 years ago
Exception calling "GetHierarchy" with "3" argument(s): "Unable to cast COM object of type
'Microsoft.Office.Interop.OneNote.Application2Class' to interface type
'Microsoft.Office.Interop.OneNote.IApplicationCOM'. This operation failed because the QueryInterface call on the COM
component for the interface with IID '{452AC71A-B655-4967-A208-A4CC39DD7949}' failed due to the following error:
Interface not registered (Exception from HRESULT: 0x80040155)."
At C:\OneNote2MarkDown\ConvertOneNote2MarkDown-master\ConvertOneNote2MarkDown.ps1:21 char:3
+   $OneNote.GetHierarchy("", [Microsoft.Office.InterOp.OneNote.Hierarc ...
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : InvalidCastException

Windows 10 on a Surface Pro 6 Office Professional Plus 2019

dwids commented 2 years ago

I got this and fixed it just now. I stumbled on this https://github.com/alxnbl/onenote-md-exporter/issues/42 and wondered if this page history etc thing was causing my problems. So I removed all the page versions for each Notebook, then emptied and disabled the Recycle bins for them. I removed ALL the generated files from the earlier attempts, including the .docx, re-ran it and it worked. All 451 notes converted.

leojonathanoh commented 2 years ago

@dwids i believe i discussed with @BoltCitizen and we ended up with a solution here: https://github.com/theohbrothers/ConvertOneNote2MarkDown/issues/101#issuecomment-907755120

SjoerdV commented 2 years ago

@BoltCitizen can we conclude that the issue you are experiencing does have something to do with having the right combined Office Apps (Word, OneNote) installed and is not really related to the script itself. Than we can proceed and close this issue as well, right?

BoltCitizen commented 2 years ago

@SjoerdV , yes, we can close it

BoltCitizen commented 2 years ago

Thx for the product and the help!