Chris J Richards 11.May.12 06:39 AM a Web browser Domino DesignerAll ReleasesAll Platforms
Hi guys,
I have some code that gets information about an attachment file, (size, source, etc) which is then stamped onto a new document, and the attachment copied to the new document.
This works fine with fields with only 1 attachment, but when there is 2 or more attachments, it created 2 documents (correct) each document has the different attachment size, source etc (correct) however each document, has both attachments on it, when i only need 1 attachment - relevent to the size, source etc that I have copied.
Is there anyway to get all objects for attachment 1, and copy attachment 1, then get all objects for attachment 2, and copy attachment 2 and so on?
Code is below... Thanks
Set rtItemAtt1 = thisDoc.GetFirstItem("Attachments_Information")
If Not (rtItemAtt1 Is Nothing) Then
If (rtItemAtt1.Type = RICHTEXT) Then
If IsArray(rtItemAtt1.EmbeddedObjects) Then
ForAll o In rtItemAtt1.EmbeddedObjects
If (o.Type = EMBED_ATTACHMENT) Then
'Get UID of eSupport document, title and size of attachment
attUID = thisDoc.Universalid
attTitle = o.Source
attSize = o.FileSize
'COPY VALUES TO NEW DOCUMENT
Set copyDoc = copyDB.CreateDocument
copyDoc.Form = "F_Attach"
copyDoc.attTitle = attTitle
copyDoc.attSize = attSize
copyDoc.attUID = attUID
copyDoc.AttDateTime = Now
'This is not the secure tab section so say "no"
copyDoc.attSecure = "No"
'Copy attachment to new document
Call rtItemAtt1.CopyItemToDocument(copyDoc,"attFile")
Call copyDoc.Save(True, False)