Folgender Code entfernt zwar das Attachment aus einem Dokument, hinterlässt aber reproduzierbar eine tote Verknüpfung im RichtextItem, in dem das Attachment war....
| Dim ws As New NotesUIWorkspace |
| Dim doc As NotesDocument |
| Dim varAttachments As Variant |
| Dim strAttachment As String |
| Dim objAttachment As NotesEmbeddedObject |
| |
| Set doc = g_dbCurrent.Unprocesseddocuments.Getfirstdocument() |
| varAttachments = Evaluate( "@AttachmentNames(1)" , doc ) |
| |
| strAttachment = ws.Prompt(PROMPT_OKCANCELLIST , "AUSWAHL", "Bitte Anhang zum löschen auswählen", "", varAttachments ) |
| |
| If strAttachment <> "" Then |
| Set objAttachment = doc.Getattachment( strAttachment ) |
| Call objAttachment.Remove() |
| Call doc.Save( True, True ) |
| End If |
wohingegen dieser Code das Attachment "sauber" entfernt:
| Dim ws As New NotesUIWorkspace |
| Dim doc As NotesDocument |
| Dim rtBody As NotesRichTextItem |
| Dim varAttachments As Variant |
| Dim strAttachment As String |
| |
| Set doc = g_dbCurrent.Unprocesseddocuments.Getfirstdocument() |
| varAttachments = Evaluate( "@AttachmentNames(1)" , doc ) |
| |
| strAttachment = ws.Prompt(PROMPT_OKCANCELLIST , "AUSWAHL", "Bitte Anhang zum löschen auswählen", "", varAttachments ) |
| |
| If strAttachment <> "" Then |
| Set rtBody = doc.Getfirstitem( "Body" ) |
| ForAll objAttachment in rtBody.Embeddedobjects |
| If objAttachment.Name = strAttachment Then |
| Call objAttachment.Remove() |
| End If |
| End ForAll |
| Call doc.Save( True, True ) |
| End If |
Erklärbar ware das u.U. damit, dass das embedded object, dass ich aus dem Document per GetAttachment hole ja keinen Bezug zum umgebenden RichtextItem hat, und damit das RichtextItem nicht aktualisieren kann.
Die Frage ist: Ist das ein Bug oder "works as Designed"... Konnte per Google nix diesbezüglich finden...