79031da543
Spell checking / Report (Push) (push) Blocked by required conditions
Spell checking / Report (PR) (push) Blocked by required conditions
Spell checking / Check Spelling (push) Has been cancelled
Spell checking / Update PR (push) Has been cancelled
Publish Dev Docs Website / build (push) Failing after 1s
Publish Dev Docs Website / deploy (push) Has been skipped
1.2 KiB
1.2 KiB
OneNote Plugin
The OneNote plugin searches your locally synced OneNote notebooks based on the user query.
The code itself is very simple, basically just a call into OneNote interop via the https://github.com/scipbe/ScipBe-Common-Office library.
var pages = OneNoteProvider.FindPages(query.Search);
The query results will be cached for 1 day, and if cached results are found they'll be returned in the initial Query() call; otherwise, OneNote itself will be queried in the delayedExecution:true overload.
If the user actions on a result, it'll open it in the OneNote app, and restore and/or focus the app as well if necessary.
if (PInvoke.IsIconic(handle))
{
PInvoke.ShowWindow(handle, SHOW_WINDOW_CMD.SW_RESTORE);
}
PInvoke.SetForegroundWindow(handle);
The plugin attempts to call the library in the constructor, and if it fails with a COMException then it'll note that OneNote isn't available and not attempt to query it again.
try
{
_ = OneNoteProvider.PageItems.Any();
_oneNoteInstalled = true;
}
catch (COMException)
{
// OneNote isn't installed, plugin won't do anything.
_oneNoteInstalled = false;
}
