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


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

Posted ByAmine on July 28, 19102 at 14:45:27:

In Reply to: Re: Use VB to detach an attachment ( and delete the document) posted byRiz on July 13, 19102 at 04:59:39:

: 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 ]