FORUM PLAN UPDATE: Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.
Alena Smart 24.Aug.16 03:52 PM a Web browser Domino Designer 7.0.3 FP1 All Platforms
Hi, I need a little help in copying all the attachments of a filed to a new document, If I have 2 files in the field then I should have two documents created.
here is the code I am using,
Dim vAttachments As NotesView
Dim CollDocAtt As NotesDocumentCollection
Dim doc As NotesDocument
Dim docAttachment As NotesDocument
Dim rtitem As NotesRichTextItem
Dim rtitemATT As NotesRichTextItem
Set docAttachment = dbAtttachment.CreateDocument
Set vAttachments = db.GetView("Attachments")
Set CollDocAtt = vAttachments.GetAllDocumentsByKey("1") ' Lin")
Set doc = CollDocAtt.GetFirstDocument
Do Until doc Is Nothing
' For all attachments in the doc we create a document in the other DB
ForAll item In doc.Items
If Item.type = RICHTEXT Then
Set rtitem = doc.GetFirstItem( Item.Name )
If ( rtitem.Type = RICHTEXT ) Then
If rtitem.values <> "" Then
ForAll o In rtitem.EmbeddedObjects ' loop and creat a doc for eatch attachments
Set docAttachment = New NotesDocument( dbAtttachment )
docAttachment.Form = "Attachments"
docAttachment.Subject = doc.Part_No(0)
Call item.CopyItemToDocument(docAttachment, "Body")' except that this copies the holl field and not just the files of it.