OneNote 2007 – The Importer


Comments [0]

onenote importer

Today I’m going to talk about the general purpose file importer I’ve built, and how it is used to allow for email importing.

Note: In order to use this application you will need to copy JPHOneNoteUtilities.dll into C:\Windows\assembly, or ensure the file is in the same directory as OneNoteImporter.

Let’s look at how OneNoteImporter.cs works. This program looks in the directory specified on the command line for sub-directories. The sub-directories should contain files that are to be included in a OneNote page. A OneNote page will be created for each directory found. The files in this directory can be of any type, but the importer treats certain files differently.

All of the files are embedded into the page along the top. If they exceed a certain width, then they will wrap and form as many rows as is necessary to accommodate all of the files in the directory. The exception to this is image files, which are placed and embedded onto a different part of the page.

Image files (.jpg, .jpeg, .gif, and .png) are embedded and inserted into the page down the right hand side. Height and width tags are used to constrain the images into an area of 240 x 180 or some proportional size there-of. The x-position for the image was chosen based on what is optimal for my UMPC.

Text (.txt) and HTML (.htm & .html) files are also embedded and inserted into the page, but down the left hand side. If images are present then the width of the text container is constrained to prevent overlap. However, if no images are present the width is unconstrained and allowed to use the available page space.

The reason these files are inserted is to allow for searching of the information contained with-in.

Hopefully, it is clear that this is a general purpose tool — if you have a directory full of files you’d like to import into OneNote this tool will do it for you.

Onenote Importer Demo

At this point, you are probably wondering how I am importing email messages from my mail client. The answer is this, I have another program that extracts all of the data from the email I am interested in, and places it in a location the importer will notice. The code that does the extraction and uploading is written in Perl. I threw it together quickly, but so far it seems to work well.

I’ve implemented this by associating an email address with the program. This way whenever an email shows up in my inbox that I’d like imported into OneNote all I have to do is bounce it to that email address, and then run the importer to pull it in.

By implementing it this way, I can send emails to that address from anywhere, and I’m not just limited to importing things from my primary inbox. For instance, if I take a picture of something interesting with my cell phone all I have to do is email the picture to my OneNote importer email address, and voila it is ready for inclusion in OneNote.

Currently this is a two-step process, but it wouldn’t take much additional work to have the importer run as a service. Then it could always watch the import directory, and pull things into OneNote as they showed up.

I haven’t been interested in taking it to that level because I want to know when I pull something into OneNote. I have security restrictions on what the Perl code will parse and upload, but if someone were to bypass that, I’d like to know about it.

Check back tomorrow and I will talk about the HTML importer that can be used for importing complete web pages into OneNote.

This software is distributed on an “AS IS” basis, without warranties or conditions of any kind, either express or implied.




Comments are closed.