stevencohn / OneMore

A OneNote add-in with simple, yet powerful and useful features
Mozilla Public License 2.0
2.65k stars 223 forks source link

Make it easy for dev to write custom command #1584

Closed mudnug closed 1 month ago

mudnug commented 1 month ago

Problem to Solve

It would be nice if this project were easy to customize because I'm finding that I need to write my own command

New Feature/Solution

Documentation

Alternative Solutions

A type of add in or extension ability that let me write C sharp code and execute it.

Additional Context

I'm trying to automate tasks that otherwise are going to consume a lot of time.

There may already be something related to this but searching for onemore plugin yields results only to the main project and not https://github.com/stevencohn/OneMore/tree/main/Plugins or any documentation.

mudnug commented 1 month ago

After struggling to get the code to build for a while, I may have found some answers here after posting this request

jasonjac2 commented 1 month ago

@mudnug glad you found the help. What are you looking to write?
Aside: if replying here keeps this open, then maybe start a discussion thread or even message me. Cheers,JAC

stevencohn commented 1 month ago

I'll reopen it. May have been too twitchy here :-)

mudnug commented 1 month ago

I was looking to write something I thought was pretty niche and would essentially allow me to hide or show page titles. That feature is not an option for the graph API, So it has to be written on the desktop. I tried getting the source code for OneMore and tried compiling it locally but was hitting issues In the end, I have met this specific need a different way.

I never did workout how I would call custom Powershell scripts from OneMore, but it appeared that the API available to Powershell did not have the feature I needed.

stevencohn commented 1 month ago

OneMore doesn't use the Graph APIs. It uses COM Interop wrapper provided with OneNote Desktop. But the COM wrapper is quite thin, basically only letting you read and write pages projected as XML. The majority of code in OneMore is all about modifying that XML.

There is no way to "hide" a page title, that I'm aware of anyway. You can remove a page title, but wouldn't be able to undelete it without saving that information somewhere to be restored.

The XML schema is described here https://github.com/stevencohn/OneMore/blob/main/Reference/0336.OneNoteApplication_2013.xsd

mudnug commented 1 month ago

Yes, I meant my first step was to write my own plugin from scratch and I hit the API limitations.

I thought it should be simple enough to hit image

So the requested feature is no longer needed for today but I could see it as being useful in the future. My next step would be to try to run those powershell scripts and determine whether they actually can manipulate OneNote in the ways I need.