theohbrothers / ConvertOneNote2MarkDown Public
forked from SjoerdV/ConvertOneNote2MarkDownNew issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to find type [Microsoft.Office.InterOp.OneNote.HierarchyScope]. #5
Comments
|
Getting this same error on a Windows 10 Pro VM running on Azure. Running in Powershell administrative mode. |
|
Sorry for being late to this - did @thanhphu 's suggestion work? Yes, it is necessary (and advisable, due to better features) to use the Office version, which is free here https://www.onenote.com/Download |
|
The same problem. I tried with The Office version. Upd. My bad - it works if PowerShell and OneNote (The Office version, not usual one!) are both started as Administrator. |
|
@rustam-python just curious, what caused your initial problem? Did you use Office version or Windows Store version? Admin or normal? |
Script is not working with OneNote started as Administrator and PowerShell started as non-Administrator. In all tries I used The Office Version of OneNote. |
|
Thanks. So it was just the admin status not matching. Yeah, that's covered in the instructions, so I won't look into this any further and close the issue. |
|
Hi Nixsee, Not sure why you closed this. He said he is still running into the same problem and I am too. I'm running 2016, Desktop version, both, VS Code and OneNote, running as admin, and I get the exact same error. Any ideas? |
|
@slappycat2 I closed it because it is a user error issue - they didn't read the instructions. Try running Powershell directly, rather than in VS Code - perhaps the Powershell in VS Code is not running as Admin. Alternatively, run both without admin (I don't use admin for either when I run it). Moreover, these errors are outside of the scope of the script - they are a windows/powershell/office problem which each person will have to resolve for themselves. |
|
Tried all of the above and no luck. I'll keep playing with it. UPDATE - For others running into this issue, I got it working, finally. The key for me turned out to be that I had to run it in the Powershell ISE (not just the Powershell). So, to recap:
|
|
Good to hear you got it working. Does normal Powershell work if you run "Set-ExecutionPolicy Bypass -Scope Process" in it? |
|
@nixsee: No, it didn't. I had to use ADMIN, too. If I find anything else worth sharing, I'll post here! Thanks! |
My bad - I forgot to mention that last time. Yes, firstly I tried without |
|
Good to hear. So, just to be thorough, does normal PowerShell (not ISE) work in non-admin mode (OneNote in non-admin as well) if you run it with |
No, only in admin mode with |
|
Just wanted to leave a note to future readers that this happens because the script requires Powershell 5 (Powershell ISE will work too). The error shows up on In contrast to the suggestion above #5 (comment), the script does not require admin privileges. |
|
Support for powershell core added in #43. If this happens on Windows Powershell <=5.x then perhaps its due to missing Onenote assemblies because the user might not have installed the desktop version of Onenote 2016. Warning message about this added in #44. Both will be included in If this still happens, please post your environment so we can find out the cause. |
|
FWIW, I also encountered the same issue while running the script in PowerShell Core 7 with Office 2021 and the solution was to run the script from PowerShell 5 with |



Run new office onenote with admin permissions and powershell with admin permissions
Version Windows 10 Pro
Version 20H2
Compilation 19042.631
Error Unable to find type [Microsoft.Office.InterOp.OneNote.HierarchyScope].
At C:\GIT\ConvertOneNote2MarkDown-master\ConvertOneNote2MarkDown-v2.ps1:357 char:31
... erarchy("", [Microsoft.Office.InterOp.OneNote.HierarchyScope]::hsPage ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : InvalidOperation: (Microsoft.Offic....HierarchyScope:TypeName) [], RuntimeException
FullyQualifiedErrorId : TypeNotFound
The text was updated successfully, but these errors were encountered: