Function RemoveFileAttachment (doc As NotesDocument, filename As String) As Integer
Dim att As NotesEmbeddedObject
Dim s As New NotesSession
Dim status As Integer
status = 0
On Error Goto ProcessError
'This is a hack to work around the NotesEmbededObject.Remove bug.
'Notes EmbeddedObject.Remove does not remove file attachments when called on Unix or AS/400 platforms running Domino 5.0 or 5.0.1 servers
If(s.Platform = "Windows/32" Or Instr( 1, s.NotesVersion, " 4.")) Then
Set att = doc.GetAttachment(filename)
If Not (att Is Nothing) Then
Call att.Remove()
End If
Else
status = RemoveFile(doc.Handle, filename) 'Use this library routine in libddwrap
RemoveFileAttachment = status
End If
Exit Function
ProcessError:
If(Err()) Then
status = Err()
End If
RemoveFileAttachment = status
End Function
previous page
|