-
Feb 20th, 2010, 10:28 AM
#1
Thread Starter
Junior Member
[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.
-
Feb 22nd, 2010, 01:07 AM
#2
Thread Starter
Junior Member
Re: vb6 Lotus Notes attachment extraction problem
I have found the solution, please do not reply.
-
May 31st, 2012, 12:32 PM
#3
Fanatic Member
Re: vb6 Lotus Notes attachment extraction problem
Originally Posted by high100
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|