I need to process all the attachments from the selected document. I have written following code :
Forall item In QAWBDoc.Items
If item.Type = RICHTEXT Then
Set rtitem = QAWBDoc.GetFirstItem(item.name)
Set navigator = rtitem.CreateNavigator
Set rtobject = navigator.GetFirstElement(RTELEM_TYPE_FILEATTACHMENT)
While Not rtobject Is Nothing
If rtobject.Type = EMBED_ATTACHMENT Then
Call ProcessAttachment(QAWBDoc, rtitem, rtobject, navigator)
attCounts = attCounts + 1
Call rtobject.Remove()
Set rtonject = Nothing
Set rtobject = navigator.GetNextElement()
End If
Wend
End If
End Forall
ProcessAttachment => function doing some operations on the attachments. Once attachment is processed I need to remove it from database.
But if document have any duplicate attachment, or same attachment attached twice, then it is giving problem while removing attachments.
What can be the solution on this?