Results 1 to 3 of 3

Thread: [RESOLVED] vb6 Lotus Notes attachment extraction problem

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2009
    Location
    INDIA
    Posts
    16

    Resolved [RESOLVED] vb6 Lotus Notes attachment extraction problem

    Hi,

    Following VB6 code download all attachments from Lotus Notes (7.**) client prefectly but it gives error while deleting the email. May be it is some refreshing issue as the current mail is deleted. Can someone help me.

    Without call.remove(true) it works fine but with this code of line, it give error "All objects must be from the same session" at line Set doc = .GetNextDocument(doc)

    My requirement is to download all attachments (all mails have mdb file only) and delete it as soon as it is downloaded.

    here is my code :

    Code:
    Dim Maildb As Object
    Dim MailDoc As Object
    Dim Body As Object
    Dim Session As Object
    Dim v As NotesView
    Set Session = CreateObject("Lotus.NotesSession")
    Call Session.Initialize("MyPassword")
    Set Maildb = Session.GetDatabase("", "myDBName")
    
    If Not Maildb.IsOpen = True Then
        Call Maildb.Open
    End If
    
    Set vw = Maildb.GetView("($inbox)")
    
    With vw
        x = 0
        ReDim LmailID(x)
        ReDim HasAttach(x)
    
        Set doc = .GetFirstDocument
        Set Item = doc.GetFirstItem("Body")
        Do
            fileNames = Session.Evaluate("@AttachmentNames", doc)
            For Each filename In fileNames
                If filename <> "" Then
                    If Right(filename, 3) = "mdb" Then
                        Set NotesEmbeddedObject = doc.GetAttachment(filename)
                        NotesEmbeddedObject.ExtractFile ("C:\Temp\" + filename)
                        Call doc.Remove(True)  
                     End If
                End If
            Next
            x = x + 1
            ReDim Preserve LmailID(x)
            Set doc = .GetNextDocument(doc) ---Here I get problem, if i put call doc.remove(true)---'
            DoEvents
        Loop Until doc Is Nothing
    End With
    
    Set Session = Nothing
    Set Maildb = Nothing
    Set vw = Nothing
    Set doc = Nothing
    Set Item = Nothing
    Set Maildb = Nothing
    Last edited by high100; Feb 20th, 2010 at 10:33 AM.

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Jan 2009
    Location
    INDIA
    Posts
    16

    Re: vb6 Lotus Notes attachment extraction problem

    I have found the solution, please do not reply.

  3. #3
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Re: vb6 Lotus Notes attachment extraction problem

    Quote Originally Posted by high100 View Post
    I have found the solution, please do not reply.
    Please put solution

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width