F1 Help 8.Jul.10 10:26 AM a Web browser Domino Designer6.5.4 FP3Windows XP
Hi There,
I have an agent which is called from the web, to handle document attachments. The notes Documents has attachments on it, but what I would like to do is move the attachment that was in the Current Revision RTF to the Previous Revision RTF. The problem I have is that after the first time, it copies all the attachments on the document....even the ones already in the Previous Revision RTF. All I would like to do i append the file that was in the current revision field into the previous revision field. Here is my code :
Function MoveAttachments(mainDoc As NotesDocument)
Dim s As New NotesSession
Dim posDoc As NotesDocument
Dim rtii As NotesRichTextItem
Dim rtnavv As NotesRichTextNavigator
Dim eoArray As Variant
Dim itemArray2 As Variant
Dim eo As NotesEmbeddedObject
Dim destDir2 As String
Dim tempDirName2 As Variant
Dim temp2 As Variant
Dim fileNM As Variant
Dim fileExtsAllowed As Variant
Const FILE_TYPES_TO_ACCEPT = "PPT,POT"
' Get a list of items in the mail-in document.
itemArray2 = mainDoc.Items
fileExtsAllowed = Split(FILE_TYPES_TO_ACCEPT,",")
MsgBox "Here 1"
ForAll x In itemArray2
If x.Type = ATTACHMENT Then
MsgBox UCase(Right(x.Values(0),3))
MsgBox "Here 2"
' Check for a valid file extension
If Not IsNull(ArrayGetIndex(fileExtsAllowed, UCase(Right(x.Values(0),3)))) Then
MsgBox "Here 3"
' Create a new temporary directory name.
tempDirName2 = Evaluate("@unique")
fileNM = Evaluate("@unique")
MsgBox "Here 3"
destDir2 = s.GetEnvironmentString("Directory",True) + "\POSTempDir-" + tempDirName2(0)
MkDir destDir2
Set rtii = mainDoc.GetFirstItem("PrevRev")
' Now create a rich text item
If rtii Is Nothing Then
Set rtii = mainDoc.CreateRichTextItem("PrevRev")
Else
Set rtnavv = rtii.CreateNavigator()
Call rtnavv.FindFirstElement(RTELEM_TYPE_FILEATTACHMENT)
Call rtii.BeginInsert(rtnavv)
End If
' Get the item we found
Set eo = mainDoc.getAttachment(x.Values(0))
' Detach it
Call eo.ExtractFile(destdir2 + "/" + fileNM(0)+ Right(x.Values(0),4))
' Attach it to the new document's rich text field
Call rtii.EmbedObject(EMBED_ATTACHMENT,"",destdir2 + "/" + fileNM(0)+ Right(x.Values(0),4))
' Remove the temporary directory
Call DeleteDirectory(destDir2)
End If
End If
End ForAll
Set rtii = Nothing
Set rtnavv = Nothing
End Function
I know the problem....the above script is getting ALL of the items on the form....Is there anyway of me to change this code so it only picks up the items in a specific field?