OneNote Interop API NavigateToUrl fails if called again too quickly
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
Sign in to comment