Skip to main content
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks

  

Sign in to participate PreviousPrevious NextNext


F1 Help 8.Jul.10 10:26 AM a Web browser
Domino Designer 6.5.4 FP3 Windows 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?

Thanks








  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

 Sign In or Register
Sign in
Forgot your password?
Forgot your user name?
Create new registration

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

Resources

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds

Wikis

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums


 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
Notes/Domino 4 and 5
IBM Connections
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
IBM SmartCloud Meetings
IBM Web Content Manager
Lotus Domino Document Manager
Lotus e-learning
Lotus Enterprise Integration
Lotus Expeditor
Lotus Protector
Lotus Quickr
Lotus SmartSuite
Lotus Symphony
Lotus Symphony Developer Toolkit Support
Lotus Workflow