As promised, here's the code for the sort sections powertoy. (Look at the end of this article under my signature for the ZIP file).

It's mostly unchanged from the 2007 version. One bug fix that I put in was to remove section groups from the sorting. Without this fix, the sections that were inside a section group would get "pulled up" to the top of the notebook. Here's the fix:

XmlNode sg = xmlDoc.SelectSingleNode("//one:SectionGroup",nsmgr);
int count = 0;//limit of 5000 section groups just to prevent an infinite loop
while (sg != null && count < 5000)
{
string docoxml = xmlDoc.OuterXml;
string nodeouterxml = sg.OuterXml.Replace(" xmlns:one=\"http://schemas.microsoft.com/office/onenote/2010/onenote\"", "");
string temp = docoxml.Replace(nodeouterxml, "");
xmlDoc.LoadXml(temp);
count++;
sg = xmlDoc.SelectSingleNode("//one:SectionGroup", nsmgr);
}

I left a note in the code to just remove the section group node in the XML instead of this XML/string manipulation. An improvement there if someone wants to tweak this addin.  I changed the tool tip you get when you hover over the toolbar icon too.

Other areas of improvement would be to add a ribbon button rather than the old icon, and possibly a progress dialog while the sorting is happening.

Oh, the last change was adding an icon for the control panel add/remove programs applet. This is simply the OneNote 2010 icon with the N and border changed to red:

clip_image001

I do this so that I can easily tell which addin is mine when I work on them and need to uninstall a version after testing. Since I have no UI skills at all, this is the best I can do to come up with a somewhat unique icon that doesn't look terrible :).

Questions, comments, concerns and criticisms always welcome,

John