Skip to content
New 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

OneNote bug? - Exception calling "Publish" with "4" argument(s): "The remote procedure call failed. (Exception from HRESULT: 0x800706BE) #112

Closed
hoodncsu opened this issue Dec 4, 2021 · 8 comments · Fixed by #130
Assignees
Labels
docs Improvements or additions to documentation
Milestone

Comments

@hoodncsu
Copy link

hoodncsu commented Dec 4, 2021

Bug

Process halts and returns error. See: CovertOneNote2MarkDown.error.log

Expectation

Successful export

Discussion

  • Many pages successfully converted before failure
  • Attempting to export manually through the OneNote UI results in an app crash, thus possible OneNote bug
  • Reproduced with two different OneNote pages in different Notebooks
  • Both pages contained only images
  • Dryrun ran successfully
  • Expand all Paragraphs in Notebook.xml ran prior

Environment

Fairly recent re-install of Windows 10 Pro, Office installed with 365 license and unused prior to conversion effort.
Windows 10 Pro Version 21H1 (OS Build 19043.1348)
OneNote for Microsoft 365 MSO (Version 2111 Build 16.0.14701.20206) 64-bit

$dryRun = 1
$notesdestpath = 'c:\temp\work\notes'
$targetNotebook = 'Ryan @ Quantworks'
$usedocx = 1
$keepdocx = 2
$docxNamingConvention = 1
$prefixFolders = 1
$mdFileNameAndFolderNameMaxLength = 128
$medialocation = 1
$conversion = 'markdown-simple_tables-multiline_tables-grid_tables+pipe_tables'
$headerTimestampEnabled = 1
$keepspaces = 1
$keepescape = 1
$newlineCharacter = 1
$exportPdf = 1
Name                           Value
----                           -----
PSVersion                      5.1.19041.1320
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1320
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Next steps for debugging

  1. Isolate page into separate notebook for testing
  2. Add text to page
  3. Reproduce on another Windows installation
@hoodncsu hoodncsu added the bug Something isn't working label Dec 4, 2021
@hoodncsu
Copy link
Author

hoodncsu commented Dec 6, 2021

Interesting findings with additional testing:

Condition Outcome
Copy page to new notebook Success
Copy section to new notebook Failed
Copy all pages in section to new section Success
Rename existing section Failed
Create a new section with same name, copy pages to it Success

I can only assume that there is something corrupt in the section that is not visible in the UI.

tl;dr Create a new section, copy pages into it, run the script again.

@jcolson
Copy link

jcolson commented Dec 20, 2021

thanks for the hint on how to fix this issue (tl;dr) ... !

@claws99
Copy link

claws99 commented Jan 10, 2022

Even I am getting the same error. Seeing the tl;dr, I created a dummy onenote doc called temp and ran the script over it. Still getting this error:

PS C:\Users\HP\Documents\ConvertOneNote2MarkDown> .\ConvertOneNote2MarkDown-v2.ps1
Configuration:
dryRun: 1
notesdestpath: C:\Users\HP\Documents\onenote-ps-export
targetNotebook: temp
usedocx: 1
keepdocx: 1
docxNamingConvention: 2
prefixFolders: 1
mdFileNameAndFolderNameMaxLength: 32
medialocation: 2
conversion: markdown-simple_tables-multiline_tables-grid_tables+pipe_tables
headerTimestampEnabled: 1
keepspaces: 1
keepescape: 1
newlineCharacter: 1
exportPdf: 1

Notebooks to convert:
temp

Converting notebook 'temp'... (Ignoring deleted notes)

Building conversion configuration for temp [Notebook]
# Building conversion configuration for New Section 1 [Section]
## Building conversion configuration for Untitled page [Page]
## Untitled page [Page]
Failed to convert page: New-Section-1\Untitled-page. Reason: Error while publishing page to docx file C:\Users\HP\Documents\onenote-ps-export\temp\docx\New-Section-1-Untitled-page.docx: Exception calling "Publish" with "4" argument(s): "Class not registered

Class not registered
"
Convert-OneNotePage : Failed to convert page: New-Section-1\Untitled-page. Reason: Error while publishing page to docx
file C:\Users\HP\Documents\onenote-ps-export\temp\docx\New-Section-1-Untitled-page.docx: Exception calling "Publish"
with "4" argument(s): "Class not registered
Class not registered
"
At C:\Users\HP\Documents\ConvertOneNote2MarkDown\ConvertOneNote2MarkDown-v2.ps1:1387 char:257
+ ... onConfigs | Convert-OneNotePage -OneNoteConnection $OneNote -Config $ ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Convert-OneNotePage


Done converting notebook 'temp' with 1 notes.
Cleaning up...
Conversion errors:
Failed to convert page: New-Section-1\Untitled-page. Reason: Error while publishing page to docx file C:\Users\HP\Documents\onenote-ps-export\temp\docx\New-Section-1-Untitled-page.docx: Exception calling "Publish" with "4" argument(s): "Class not registered

Class not registered
"
Exiting.

@ViridityCorn
Copy link

ViridityCorn commented Mar 7, 2022

I am recieving the exact same error as @kishorekumarxyz, with the error occurring at the exact place.

EDIT: I just fixed the issue by making sure Microsoft Word was installed and opened as adminsitrator. This worked for me.

@jdustinlewis
Copy link

I had a similar error (but with code 0x80042006). The cause was I was using a relative path for my $notesdestpath. Changed from '.\notes' to the full path and it worked.

@leojonathanoh leojonathanoh added docs Improvements or additions to documentation and removed bug Something isn't working labels Jul 7, 2022
@eGregiousGames
Copy link

eGregiousGames commented Nov 10, 2022

I'm getting the "Exception calling "Publish" with "4" argument(s): "Class not registered"" error. Have got OneNote and Office both opened as admin, with a Word window open, and am opening Powershell as admin too. Have tried creating a whole new test section and even that's not getting through.

@leojonathanoh
Copy link
Member

@eGregiousGames yours doesn't seem related to this issue, see #101 (comment) and #101 (comment) which may help.

@imadjamil
Copy link

imadjamil commented Jan 12, 2023

I know this is closed, but for future readers, I succeded to resolve this just by changing the order of pages in the section in question (i moved the first page down) !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants