mirror of
https://github.com/microsoft/PowerToys
synced 2025-08-31 06:25:20 +00:00
Adding OneNote plugin for PowerToys Run (#18558)
* Adding OneNote plugin for PowerToys Run * Updating to 3.0.1 dependency, updating md, spellcheck, ready for PR * Updating spelling and using localized string * Adding OneNote link to readme * Adding OneNote requirement to description * removing 'open' from description * Updating interop version, PR feedback
This commit is contained in:
36
doc/devdocs/modules/launcher/plugins/onenote.md
Normal file
36
doc/devdocs/modules/launcher/plugins/onenote.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# 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.
|
||||
|
||||
```csharp
|
||||
var pages = OneNoteProvider.FindPages(query.Search);
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
```csharp
|
||||
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.
|
||||
|
||||
```csharp
|
||||
try
|
||||
{
|
||||
_ = OneNoteProvider.PageItems.Any();
|
||||
_oneNoteInstalled = true;
|
||||
}
|
||||
catch (COMException)
|
||||
{
|
||||
// OneNote isn't installed, plugin won't do anything.
|
||||
_oneNoteInstalled = false;
|
||||
}
|
||||
```
|
@@ -8,6 +8,7 @@
|
||||
- [Calculator](/doc/devdocs/modules/launcher/plugins/calculator.md)
|
||||
- [Folder](/doc/devdocs/modules/launcher/plugins/folder.md)
|
||||
- [Indexer](/doc/devdocs/modules/launcher/plugins/indexer.md)
|
||||
- [OneNote](/doc/devdocs/modules/launcher/plugins/onenote.md)
|
||||
- [Program](/doc/devdocs/modules/launcher/plugins/program.md)
|
||||
- [Registry](/doc/devdocs/modules/launcher/plugins/registry.md)
|
||||
- [Shell](/doc/devdocs/modules/launcher/plugins/shell.md)
|
||||
|
Reference in New Issue
Block a user