Outlook Notes to OneNote (2010)

Status
Not open for further replies.

Ian Thomas

Senior Member
Outlook version
Outlook 2013 64 bit
Email Account
Outlook.com (as MS Exchange)
Using Outlook 2010, File>Options>Advanced>Export I can export my Outlook 2010 Notes to various formats, but this inbuilt function omits the relevant dates, last modified and created.
Is there some VBA code, or .NET VSTO or other code preferably, on which I can base a simple utility for myself to export all my Notes in one go?

This would be my first step in importing those OL notes to OneNote - and eventually to use OneNote entirely, so that I can sync with OneNote on OneDrive (SkyDrive) and use it for desktop and Windows Phone.

(I would expect that someone has done this already, but I can't locate any add-ins, code, or commercial applications to do this commonly-asked task)
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
print to onenote might keep the dates, but the notes are less usable as images. i'll see what i can find for exporting macros - i have one for journal items but i don't know if i can change it; what the solution might be is to use a macro to add the dates to notes before export. But i'll look at both methods.
 

Ian Thomas

Senior Member
Outlook version
Outlook 2013 64 bit
Email Account
Outlook.com (as MS Exchange)
print to onenote might keep the dates, but the notes are less usable as images. i'll see what i can find for exporting macros - i have one for journal items but i don't know if i can change it; what the solution might be is to use a macro to add the dates to notes before export. But i'll look at both methods.
I can't understand why there isn't a simple add-in for either Outlook or OneNote, to facilitate transition to OneNote.

My requirement is one-off. I have progressed a little, and I will add links and accurate attributions, and code - later. This may guide others who would like to do something similar.

The first stage of this small project is completed, which was to export the Notes to individual files on disk in RTF format. I used VBA's object model - rough enough for a start.

My code was derived as follows: directly copied from the VBA code originally shown by John Guin; modified 2010 by WJ Pommersheim (a few filters of filename disallowed characters); and I added a few more filename refinements myself, and changed writing individual text files for each Note to a similar iteration through the Notes but using SaveAs.

The SaveAs RTF export adds the modified date into the 'Body', and WJ Pommersheim wrote the Notes (.rtf) files into folders on disk, according to their Categories. I would have liked the Creation date as well (within the 'Body' of the RTF files).

I decided that the RTF format was best for my purposes, though I haven't investigated the other SaveAs types (OlSaveAsType enumeration is olHTML, olMSG, olRTF, olTemplate, olDoc, olTXT, olVCal, olVCard, olICal, and olMSGUnicode). olDoc may be more useful.

I am not sure whether I should have single 'pages' (ie, rtf disk files) or an aggregate. I think olDoc format would allow me to concatenate files more easily than olRTF.

My next small task is to import into OneNote. Perhaps I will modify the text importer (? again written by John Guin), or one of the Onetastic macros. I think that I want these individual Notes aggregated into a single notebook, as separate pages. Once into OneNote, I am hoping that the Onetastic macros can be used to do some formatting and rearranging.
 

Ian Thomas

Senior Member
Outlook version
Outlook 2013 64 bit
Email Account
Outlook.com (as MS Exchange)
An update:
I discovered that the VBA object model (Outlook 2010, 2007) - when using SaveAs with the olHTML constant - is not useful for my purpose, because it creates HTML that consists of the voluminous MSO style information and the file + File folder and its several files that MS Word and Internet Explorer save.
That complicates what is necessary for importing Notes into OneNote - which is clean HTML, with a couple of XML namespaces prepended up front.
I discovered a nice code sample for RTF to HTML conversion written by one of the Microsoft guys, Matthew Manela
(http://code.msdn.microsoft.com/Converting-between-RTF-and-aaa02a6e ) which works well - but requires use of the System.Windows.Controls.RichTextBox (ie, a UI component) which can load RTF/XAML from a stream and save it as XAML/RTF.
Its use of the RichTextBox is not convenient for the batch processing of hundreds of RTF files (exported from Outlook Notes).
So, I am still looking for a simple, clean RTF to HTML conversion routine.
The final stage - importing the HTML into OneNote - is a simple adaptation of the Text Importer PowerToy for OneNote 2010, courtesy of John Guin (also a MSFT guy).
http://blogs.msdn.com/b/johnguin/archive/2010/06/24/the-text-importer-powertoy-gets-updated-for-onenote-2010.aspx
Instead of importing plain text, and wrapping it in HTML tags, I will process the HTML files that are generated (conversion code tba) - prepending the XML namespaces for NewOutline and NewOutlineContent.
 
Status
Not open for further replies.
Top