Re: Use VB to detach an attachment ( and delete the document)


[ Follow Ups ] [ Post Followup ] [ Knowledge Management Discussion ] [ FAQ ]

Posted ByRiz on July 13, 19102 at 04:59:39:

In Reply to: Use VB to detach an attachment posted byMomoko on July 09, 19102 at 06:35:08:

try this code, using COM
-----------------------
Function detachFile()

Dim s As New NotesSession
Dim db As NotesDatabase
Dim v As NotesView
Dim doc As NotesDocument
Dim Object As NotesEmbeddedObject
Dim filename As String

Call s.Initialize
' s.Initialize asks PASSWORD OF CURRENT USER
'(Notes Client must be running on the machine)

Set db = s.GetDatabase("riz.lahore.com", "Mail\username.nsf")
Set v = db.GetView("($Inbox)")
Set doc = v.GetFirstDocument

While Not (doc Is Nothing)
Set Object = doc.GetAttachment("crs.cfg")
If Not (Object Is Nothing) Then
'MsgBox "Found an object named embObject"
filename = "c:\test\" & Object.Name
Call Object.ExtractFile(filename)
' if u want to delete the document
Call doc.Remove(True)

MsgBox "file Extracted"
End ' Stop searching
End If
Set doc = v.GetNextDocument(doc)
Wend
MsgBox "File " + " crs.cfg " + " not found in INBOX."
End Function




Follow Ups



Post Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ Knowledge Management Discussion ] [ FAQ ]