This project has been moved to the PageKey GitLab. Here is the link:
pagekey / onenote-to-markdown Goto Github PK
View Code? Open in Web Editor NEW๐ Scripts to convert OneNote notes to plaintext markdown files.
๐ Scripts to convert OneNote notes to plaintext markdown files.
This project has been moved to the PageKey GitLab. Here is the link:
There are two types of OneNote applications a user can have installed on their PC:
When using "OneNote for Windows 10" and running convert.py
, the application will throw the following message !!!Error!!! Hint: Make sure OneNote is open first.
.
I opened the OneNote.
Then I just run the .\convert3.ps1
in the repo.
After a while, I saw below error.
New-Object : Retrieving the COM class factory for component with CLSID {DC67E480-C3CB-49F8-8232-60B0C2056C8E} failed
due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005
(CO_E_SERVER_EXEC_FAILURE)).
At C:\D\sources2\onenote-to-markdown\convert3.ps1:7 char:12
+ $OneNote = New-Object -ComObject OneNote.Application
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [New-Object], COMException
+ FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand
You cannot call a method on a null-valued expression.
At C:\D\sources2\onenote-to-markdown\convert3.ps1:9 char:1
+ $OneNote.GetHierarchy("", [Microsoft.Office.InterOp.OneNote.Hierarchy ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
onenote-to-markdown> .\convert3.ps1
`
New-Object : Retrieving the COM class factory for component with CLSID {DC67E480-C3CB-49F8-8232-60B0C2056C8E} failed due to the following error: 80080005 Server
execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
At C:\Notebooks\Polytek\onenote-to-markdown\convert3.ps1:7 char:12
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You cannot call a method on a null-valued expression.
At C:\Notebooks\Polytek\onenote-to-markdown\convert3.ps1:9 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
`
I used the script on win11 with the intention to import my older OneNote-notes in Obsidian.
It worked well, except for the images.
Obsidian doesn't recognize for example:
![](media/image1.png){width="9.604166666666666in"
height="0.34375in"}
Just as a personal feedback :) thanks for creating and sharing the script
Hello Using powershell7 with onenote for windows 10 and am receiving the following error (see below). I have set my policy to unrestricted and installed python3 and Pandoc , my os is Win10 pro
InvalidOperation: C:\Users\username\onenote-to-markdown\convert3.ps1:9
Line |
9 | โฆ erarchy("", [Microsoft.Office.InterOp.OneNote.HierarchyScope]::hsPage โฆ
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Unable to find type [Microsoft.Office.InterOp.OneNote.HierarchyScope].
Thank you
My last commit breaks image links if they have whitespace in filename. https://talk.commonmark.org/t/whitespace-in-image-paths/1121/7
Code requires workaround.
I'm getting this error:
!!WARNING!! Page Failed: C:\Users\jason\Desktop\OneNoteExport\Jason_K_s_Notebook\Health\015_Enneagram_Personality_Result___Type_4w3.md
!!WARNING!! Page Failed: C:\Users\jason\Desktop\OneNoteExport\Jason_K_s_Notebook\Health\016_Five_Minute_Journal___Daily_Journal_Techniques_and_Tips.md
!!WARNING!! Page Failed: C:\Users\jason\Desktop\OneNoteExport\Jason_K_s_Notebook\Health\017_Vaccination_Card_3_shots.md
Traceback (most recent call last):
File "C:\Users\jason\GitHub\onenote-to-markdown\convert.py", line 121, in <module>
handle_element(onenote, child)
File "C:\Users\jason\GitHub\onenote-to-markdown\convert.py", line 101, in handle_element
handle_element(onenote, c2, os.path.join(path, safe_str(elem.attrib['name'])), i)
File "C:\Users\jason\GitHub\onenote-to-markdown\convert.py", line 103, in handle_element
hier2 = onenote.GetHierarchy(elem.attrib['ID'], win32.constants.hsPages, "")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jason\AppData\Local\Temp\gen_py\3.11\F2A7EE29-8BF6-4A6D-83F1-098E366C709Cx0x1x0\IApplication.py", line 63, in GetHierarchy
return self._ApplyTypes_(1610743808, 1, (24, 0), ((8, 1), (3, 1), (16392, 2)), 'GetHierarchy', None,bstrStartNodeID
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jason\GitHub\onenote-to-markdown\.venv\Lib\site-packages\win32com\client\__init__.py", line 572, in _ApplyTypes_
self._oleobj_.InvokeTypes(dispid, 0, wFlags, retType, argTypes, *args),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pywintypes.com_error: (-2147023174, 'The RPC server is unavailable.', None, None)
!!!Error!!! Hint: Make sure OneNote is open first.
OneNote is open but something causes it to close causing the RPC error. Nothing gets written the desktop either.
There needs to be some error handling. I'm reviewing the youtube video and seeing if I need to clear anything. I'm using OneNote for Windows 11 and everything is updated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.