Hi,
I have a rich text field on a saved document with an attachment in it in a db1 and I use CopyAllItems
to copy it to another document, the attachment, in a db2. I have 2 agents, one of them runs on client and the otre in web.
I throw the agents from an action view.
It works fine in notes and web, my cod copies all items including “Rich Text items”
from the current document(notes o web) on newly created document.
I have saved the destination document before copying items.
when I try to see the attachments with an action,in destination db (db2), it works fine in notes client,
In document properties, rich text field isn’t empty, and $File is ok,…, but in web doesn’t work.
When I try to do link on the attachments, I get the error:
HTTP Web Server: Lotus Notes Exception - Entry not found in index .
I get the same error, if I run the agent from notes client, and I try to see the attachments in web,or
if I run the agent from web.
But If I create a new document in db2, with attachments, and I try see them, in web, it works fine.
This is my code that copyAllItems(web agent)
Sub Initialize
Dim osesi As New NotesSession
Dim odbHist As New NotesDatabase( "", "" )
Dim odb As NotesDatabase
Dim onote As NotesDocument, odoc As NotesDocument, odocHist As NotesDocument
Dim IDBDHist As String
Set odb = osesi.CurrentDatabase
Set onote = osesi.DocumentContext
If onote Is Nothing Then
Pinta("Not context doc found")
Exit Sub
End If
IDBDHist =Trim(Left(onote.IdBd_Hist_NotiMark(0),8)+Right(onote.IdBd_Hist_NotiMark(0),8))
If odbHist.OpenByReplicaID(odb.Server, IDBDHist) Then
If onote.DocSelec(0) <> "" Then
Forall idDoc In onote.DocSelec
Set odoc = odb.Getdocumentbyunid(idDoc)
Set odocHist = odbHist.createdocument()
Call odocHist.save(True,True)
Call odoc.copyallitems(odocHist)
success = odocHist.computewithform(False, False)
Call odocHist.save(True,True)
Call odoc.remove(True)
End Forall
Print |<script>|
Print |parent.close();|
Print |</script>|
Else
Pinta("select documents.")
End If
End If
End Sub
And This is the code to see the attachments(web agent)
Dim osession As New NotesSession
Set odb = osession.CurrentDataBase
Set odoc = osession.documentContext
Set oView = odbActual.GetView("TID")
Call oView.Refresh
Set odocNot = oView.GetDocumentByKey(odoc.IdDOC(0))
Set odocP = odb.GetProfileDocument("F000")
dirIP = odocP.dirIP(0)
elements = odocNot.ID_Attach
element = odoc.SelecAttach(0)
For i = 0 To Ubound(odocNot.sizeAttach)
If elements (i) <> element Then Goto Siguiente
Set ortitem = odocNot.GetFirstItem( "Anexo" )
If ( ortitem.Type = RICHTEXT ) Then
Forall o In ortitem.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) Then
sname = o.Source
If sname = element Then
Print |<SCRIPT LANGUAGE="JavaScript">|
Print |window.location.href = '\\' + opener.bd + '/TID/| + odoc.IdDOC(0) + |/$File/| + sname + |';|
Print |</SCRIPT>|
End If
End If
End Forall
End If
Exit Sub
Siguiente:
Next
End Sub
I don’t guess what’s wrong when I copyallItems…
Any help will be greatly appreciated.