Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use VB6 move one Lotus Notes (R5) email from Inbox to another folder

Status
Not open for further replies.

mingichu

MIS
Apr 12, 2002
29
US
Hi, all experts,

I'm looking for a way to move one Lotus Notes (R5) email from Inbox to another folder (called "Folder1") using VB6. Does anyone know how to do it?
Below are my current codes.

Thanks in advance!!!
==================
Dim NotesSession As Object
Dim NotesDb As Object
Dim NotesDoc As Object
Dim strServerName As String
Dim strUserDb As String

Dim View As Object
Dim vCurrDoc As Object
Dim vRemoveDoc As Object
Dim item As Variant
Dim attch As Variant
Dim vSubject As String

Const vRICHTEXT = 1

On Error GoTo Err

strServerName = "MyServerName"
strUserDb = ""
Set NotesSession = CreateObject("Notes.NotesSession")
Set NotesDb = NotesSession.GETDATABASE(strServerName, strUserDb)

NotesDb.OPENMAIL

Set View = NotesDb.GETVIEW("($Inbox)")
Set vCurrDoc = View.GETFIRSTDOCUMENT

Do While Not (vCurrDoc Is Nothing)
vCnt = vCnt + 1

If vCurrDoc.HASITEM("FailureReason") = True or _
vCurrDoc.HASITEM("Subject") = False Then

'''' HERE I WANT TO MOVE THIS EMAIL TO ABOTHER FOLDER called Folder1..., and go to next email

Loop
==============================
 
Here's the command in LotusScript, not sure exactly how you would modify it to work in VB:

Code:
Call vCurrDoc.putinfolder("Folder1")

as great as TekTips is, the Lotus Notes users are few and far between! I found the above information at

it's Lotus's website, check the Forums & Community Link and you'll find the R4/R5 forum. There's a LOT of help and information on that site. Unfortunately, Notes has such a weird syntax (who would have thought that the command to put something in a folder would be called PutInFolder?????), it's hard to figure out what to search for sometimes!

HTH

Leslie
 
I tried your code. It copied the email to the "Folder1" folder. So the inbox still have the same email.
Because my purpose is to move the email to the "Folder1" from the Inbox, so I added codes to remove the email (see code below).

However, it remove both emails in Folder1 and Inbox.....

Is there anyway to just move the email to the other folder?
Thanks!!!
======================================
vCurrDoc.PUTINFOLDER ("Folder1")
vCurrDoc.Remove (True)
Set vCurrDoc = View.GETNTHDOCUMENT(vCnt)
 
I bet that's because it still has the same document id. Maybe if you put a copy of the original document (make sure the UID changes) then you can delete the original? I can't find a MoveToFolder option.

Leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top