Adding attachments using Script

Hi All,

I have a Action button and on click of that I would like to add a file as attachment using Lotus Script. Can anybody suggest me how to go about this.

Subject: Adding attachments using Script

hiyou should search the designer help:

‘Notesrichtextitem’

example modified for a button

→ hope this will help you:

Dim session As New NotesSession

Dim db As NotesDatabase

Dim uidoc As Notesuidocument

Dim doc As NotesDocument

Dim rtitem As NotesRichTextItem

Dim object As NotesEmbeddedObject

Set db = session.CurrentDatabase

Set uidoc = db.CurrentDocument

Set doc = uidoc.Document

Set rtitem = New NotesRichTextItem( doc, “Body” )

Set object = rtitem.EmbedObject _

( EMBED_ATTACHMENT, “”, “c:\jim.sam”)

Call doc.Save( True, True )

Some of the actions are related to Backend,

you have to modify it to see it work immediately on the UIdocument - (i didnt test it)

H.Mueller

Subject: RE: Adding attachments using Script

Hi,

I tried this but the problems are:

  1. I want the attachment to be added to the Current Document. I tried that getting the Doc from NotesUIDoc, it adds but

  2. The UI will not get reflected after adding the attachment. We have to close and open again.

  3. The attachment will not be placed where the cursor is, like in Mail memo.

  4. The attachment will not have an ICON.

Can you suggest me how to get these above problems solved.

Thanks,

Agasthya

Subject: RE: Adding attachments using Script

If you really mean it when you specify “Domino Access for Outlook” and “All Platforms”, then I cannot help you.In a Notes client on Windows you can use code like this sample. The sample does not add an attachment. You must change the sample to make it add an attachment. It will work on the current document, directly in the UI, at the current cursor position, and it will create the normal icon for the attached file.

Subject: RE: Adding attachments using Script

Hi,

Sorry the category is application development.

I tried the sample code for the hot spot that’s good sample and working fine. But my req. is to add an attachment in the curosr location and the file should have the respective icon that the application will have.

Is there any way to raise an event through lotus script. Which takes the file path and calls the @Function passing the file path. So that the @function will place the attachment with the ICON.

Thanks,

Agasthya

Subject: RE: Adding attachments using Script

Hi,

I tried the sample, but i didn’t find proper file attachment API in Lotus script. I am using NotesRichTextItem EmbedObject, which is adding to the end of the Memo. Is there anything I am missing.

Thanks in advance,

Agasthya

Subject: RE: Adding attachments using Script

It is not enough to try the sample. I wrote: “You must change the sample to make it add an attachment.” I do not have sample code that adds an attachment. You must write the code.

Subject: Adding attachments using Script - Solution

Hi Guys,

I got the solution for adding an attachment to the form.

notesUIDoc.CreateObject(“”,“”, filename)

will attach the file at the current cursor location with the icon.

Cheers,

Agasthya

Subject: RE: Adding attachments using Script

hi

1./2./3. Seems a difficult thing and I didn’t find a solution without reopening or place at cursor posititon - sorry

  1. In Notes/Domino 4 and 5 -Forum they said there will be no icon by using script