Some updates to the OneNote Calendar/Planner powertoy

 

Well, my "well tested" calendar/planner had an easy to fix but obvious problem - it always sent the calendar pages to Unfiled Notes.  I had copied and pasted code from my text importer and that was the cause.  The text importer application used the name of the folder which held the text files as a new section name, so only returned the name of the notebook in which to add a new section and new pages.  This application needs a section in which to put the pages (pages cannot be created directly into a notebook - they need a section) and the tree list was only giving a notebook name.

 

It was a one line fix.

 

Change this:

 

onApp.GetHierarchy(System.String.Empty, OneNote.HierarchyScope.hsNoteBooks , out strHierarchy);

 

To this:

 

onApp.GetHierarchy(System.String.Empty, OneNote.HierarchyScope.hsSections , out strHierarchy);

 

I bold faced the part I changed.  Now the tree control shows you the notebook name and the section name, and returns the section name when you select one.  What had been happening was the tree control was returning the name of a notebook, which caused an error.  I had to deal with this error for this scenario:

 

You have a shared notebook.  When you start the application, the notebook has 2 sections, and the tree view loads them and shows them.  While you are running the application, the section you want to use is deleted by a different user.  I decided to deal with this by defaulting to use Unfiled Notes, since it is always available.

 

Since the notebook name the control was giving was causing an error, the Unfiled Notes section automatically got used instead.  That particular error doesn't get logged either.

 

I was also thinking of making a new section for each month name, but quickly ran into design problems.  Since the original request from "SubSeaGuy" was for a full year, making 12 sections seemed somewhat reasonable.  But since I allowed for a given number of pages to be 1 or more, a whole section to hold a week's worth of pages didn't seem reasonable.  The more I thought about it, the more I thought of other uses that made no sense for a section to be named for each month chosen.  Some people will want weekly agendas.  Some want quarterly.  In the end, I talked myself into a simpler implementation. 

 

My only tool to create this was Visual Studio Express.  That particular version does not include the capability to build a setup project.  That's why I just have the .EXE file (which I also just zipped instead of making you rename it) by itself.  

 

Again, sorry for the initial problems, but they seem to be worked out now.

 

Question, comments, concerns and criticisms always welcome,

John