Personal Blog of Thomas Hampel - Creative Mythbusting in Development and Collaboration

Who am I?

Feeds

Previous Document Next Document

NotesAPI - Import Pictures into RichText Fields using Backend Classes

Thomas Hampel
 26 August 2014

Importing pictures into a RichText field as embedded object is easy in the Notes Client. One can use the File\Import function to get this done - unfortunately this function is not available when running scheduled agents on a server.
So how can it be done?

Some time ago
Andre Guirard published a LotusScript example as part of the OpenNTF project LotusScript Gold Collection to import a picture using the NotesDXLExporter class to export an existing NotesDocument to XML while then injecting the new image including all its metadata into this XML.

Oh and of course I know we could be using
Tivoli Directory Integrator or commercial solutions such as...
But why installing another software or using 3rd party solutions if there are existing API calls that can be used. So yet another - less expensive - method to import pictures into RichText is the Notes API.
Beside being faster, this method is will also work for older versions of the Notes Client, so feel free to use this script for mass-import of pictures into the Domino Directory
 

ImportPicturesToRichText.lss


(Thanks to Rod Whiteley for this old
forum post)
Tagged with: API Code
Comments

1.) Untitled

Ben Langhinrichs http://geniisoft.com/showcase.nsf/GeniiBlog 27/08/2014 18:53:50

I'm always pleased to see anyone working with and extending the functionality of Notes rich text. (As a minor clarification, Midas would be sold as client software for this sort of purpose and that would be $1500 for 50 users - but it hardly matters in this context.)

Just as when the Notes Import library came out, I welcome different solutions that will help people, especially when the need is for a simpler, less robust solution. Why spend a lot when you can do it for free? We have plenty of customers who need far more, but I'll keep this in mind if (as happens periodically) people come looking for a simple solution and have no real budget. Thanks for posting.

2.) Untitled

Barry http:// 28/08/2014 19:12:25

Using Voith's code Import Image 2 Lotus Notes (II2LN) allows more that just import of a photo. It allows sizing. cropping and watermarks and other features

3.) Untitled

Malte 29/01/2016 15:25:31

Hi,

this code doesnt work well. Only 70% of my images are imported properly.

Some richtextfields are missing and other field contains image data but the image is not shown. No errors.

Any suggestions?

Thomas Hampel, All rights reserved.