Lotusscript: Multiple attachments help

EditEditNew topicNew topicPost responsePost responseAdd to My InterestsAdd to My InterestsPreviousPreviousNextNext

Lotusscript: Multiple attachments

Posted by Bafie Becker on 3.Feb.05 at 02:43 PM using a Web browser

Category: Domino Designer – LotusScriptRelease: 5.0.11Platform: Windows 2000

Hi,

I am trying to attach more than one file to a RT field. But the original attachment gets overridden. I am not sure how to “append”? I could not get a clear answer in the search on this Forum.

Also, I am reloading the doc after the attachment and would like the focus to go back to the origan field. However, it does not seem to be working at all???

Please see code.

Any help greatly appreciated!!

Thanks

Bafie

Dim w As New notesuiworkspace

Dim s As New NotesSession

Dim db As notesdatabase

Dim uidoc As notesuidocument, uidocnew As NotesUIDocument

Dim ws As New NotesUIWorkspace

Dim object As notesembeddedobject

Dim doc As notesdocument

Dim filenames As Variant

Dim filenames2 As String

Dim StrFieldFocus As String

Set db = s.currentdatabase

Set uidoc = w.currentdocument

Dim rtitem As Variant

Set doc = uidoc.Document

StrFieldFocus=uidoc.CurrentField

filenames = ws.OpenFileDialog(False, “Select files to be attached”,“”,"c:")

filenames2=Cstr(filenames(0))

'Create New RichTextItem in the current document

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

'Attach the doc

Set object = rtitem.EmbedObject ( EMBED_ATTACHMENT, “”, filenames2 )

'Version of notes?

If s.NotesBuildVersion >=190 Then

rtitem.Update

Else

Call doc.ComputeWithForm(True,False)

End If

doc.saveoptions = “0”

Call uidoc.Close(True)

Set uidocNew= ws.EditDocument(True,doc, , , , True)

Delete uidoc

uidocNew.Document.RemoveItem(“SaveOptions”)

If StrFieldFocus <> “” Then

uidocnew.GotoField (StrFieldFocus)

End If

End Sub

Subject: Lotusscript: Multiple attachments help

Please don’t paste the whole page in like that – edit before hitting Submit.

When you use New NotesRichTextItem, you create a new field to replace the old one. Use doc.GetFirstItem to grab the existing field.