In my last post, I introduced a new Notes Migrator for SharePoint feature for saving embedded images, attachments and OLE objects to a different location than the "main" document being migrated. I showed the feature in use with a List Item, but today we are going to talk about using that feature with Library Files instead.
Suppose you wanted to generate HTML files instead of rich text items. It is trivial to tell Notes Migrator for SharePoint to render (for example) a rich text "Body" field as HTML and then save it as a .HTM file in a Document Library. In the example below, we are mapping the default "BodyHtml" source field to a target field of type "File" called "File0". Also note that in this example we are using the Notes "Subject" field to generate the HTML file name by mapping it to a target field of type "FileName".
The above job, which could have been created with version 1.0 of our tool, works fine for migrating simple rich text fields. The problem is that HTML files cannot contain embedded images and attachments, so those would have been missing. Up until now the only good solution was to generate multi-part MIME files instead of "plain" HTML files. But what many people would prefer to do is migrate those embedded "parts" as separate files and automatically fix up the HTML to point to them. That is exactly what our new version 5.1 feature allows you to do.
The trick is to add additional File mappings but flag them as "alternate" files (i.e. files sent to an alternate location). In the following example, we have added additional file mappings for the embedded images, attachments and OLE objects. In the previous article, we specified the AlternateLibrary property which sent the embedded parts to a separate library. This time, we instead want to map the images to a sub-folder called "Images". Therefore we will map the "BodyImages" source field to a target "File" field which specifies the AlternateFolder property "Images" and we will leave the AlternateLibrary property blank. Similarly, the attachments and embedded objects will be places in a sub-folder called "Attachments".
The other interesting part of the above example is that we have an additional target field of type "FileName" called "AltFileName". Unlike the first "FileName" field discussed above, this one controls the file name of any images and embedded objects that were not stored with their own file names in Notes. How can we tell the difference? That is the purpose of the new AppliesTo property. By setting the AppliesTo to "AlternateOnly", whatever data is mapped to this field will impact the alternate parts and not the main item being written.
Now when we run the job, the HTML files are written to the target SharePoint document library and the embedded parts are written to the Images and Attachments sub-folders.
One final note: If we wanted to write the images and attachments to a different library, we could have done that by specifying the AlternateLibrary property. You can also use AlternateLibrary and the the AlternateFolder property in combination.