Ich möchte mit selktierten Dokumenten einen Agent starten der aus den selektierten Dokumenten ein paar Informationen rausholt - auch das Body Feld - und diese dann in ein neues Dokument kopiert und speichert.
So wie's da unten steht funkt es nicht.
Danke für eure Vorschläge
lg/hannes
**********************
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim newdb As NotesDatabase
Dim doc As NotesDocument
Dim newdoc As NotesDocument
Dim RechnerName As variant
Dim SystemName As Variant
Dim Kunde As Variant
Dim Ort As Variant
Dim RVCreator As Variant
Dim RVCreationDate As Variant
Dim neuerBetreff As String
Dim RVNrView As NotesView
Dim RVDoc As NotesDocument
Dim RVNR As NotesItem
Dim BodyA As NotesItem
Dim BodyB As NotesItem
Dim LetzteRVNummer As Variant
Dim RAll As NotesItem
Dim Status As NotesItem
Dim FormType As NotesItem
Set db = session.CurrentDatabase
Set newdb = New NotesDatabase( "APPL01.AT.ABB.COM/SRV/ABB", "GLOBAL\ATABB\ATABB174.NSF" )
'Set newdb = New NotesDatabase( "", "GLOBAL\ATABB\ATABB174.NSF" )
Dim collection As NotesDocumentCollection
Set db = session.CurrentDatabase
Set collection = db.UnprocessedDocuments
Set doc = collection.GetFirstDocument
'Set newdoc = newdb.CreateDocument
newdoc.Form = "RV"
Set newdoc = New NotesDocument(newdb)
'newdoc.Form = "RV"
If (Not collection Is Nothing) Then
RechnerName = doc.GetItemValue( "_RV_Hostname" )
SystemName = doc.GetItemValue("_NLDocSubject")
Kunde = doc.getItemValue("_NL_Kunde")
Ort = doc.getitemvalue("_NL_Anlage")
RVCreator=doc.Getitemvalue("RV_Creator")
RVCreationDate=doc.GetItemValue("RV_CreationDate")
Set BodyA = doc.GetFirstItem("Body")
neuerBetreff =RechnerName(0) + " - " + SystemName(0)
newdoc.DocSubject = neuerBetreff
newdoc.Kunde=Kunde
newdoc.Ort=Ort
newdoc.DocAuthor=RVCreator
newdoc.DocCreationDate=RVCreationDate
Call BodyB.CopyItemToDocument(newdoc, "Body")
' ######### RV Nummer Ermittlung START ############
Set RVNrView = newdb.GetView( "RVLfdNr")
Set RVDoc = RVNrView.GetLastDocument
LetzteRVNummer = RVDoc.GetItemValue( "RVNummer" )
LetzteRVNummer(0)=LetzteRVNummer(0)+1
Set RVNR = newdoc.ReplaceItemValue( "RVNummer", CStr(LetzteRVNummer(0)))
Set RAll = newdoc.ReplaceItemValue("DocReaders","$ATABB_174_Editors")
Set Status = newdoc.ReplaceItemValue("DocStatus","0")
Set FormType = newdoc.ReplaceItemValue("FormType","RV")
' ######### RV Nummer Ermittlung END ############
Call newdoc.Save( True, True )
'Set newdoc = newdb.CreateDocument
Set doc = collection.GetNextDocument(doc)
End If
End Sub