OneNote Interop API NavigateToUrl fails if called again too quickly

stemarcoh 21 Reputation points
2022-11-15T13:36:59.937+00:00

C# with .NET Framework 4.8, OneNote 16.0.15726.20188 64-bit

Using the Interop API, IApplication.NavigateToUrl(pageURL)

Invoke once with a valid page URL, it succeeds

Invoke again (within about two seconds) with a different valid page URL, it fails with COMException, HResult: 0x80042014 "The object does not exist"

However, if you wait at least about three seconds in between calls, then it will always succeed.

It doesn't matter whether the second page is in the same notebook or a different notebook. All notebooks tested here are synced to the cloud.

It appears that NavigateToUrl causes the notebook to sync, because the OneNote notebook panel shows the sync glyph on top of the notebook icon and that is perhaps blocking subsequent interop APIs until completed?

The IApplication instance is instantiated and disposed in a "using" block for each call

OneNote
OneNote
A family of Microsoft products that enable users to capture, organize, and reuse notes electronically.
203 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,986 questions
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.