Copytodatabase

hi all i have a mail file to receive emails and several other programs read these email (by pop3) and do auto processing …the mail file is in lotus…as of now the outlook client which retrives these mail leave a copy at the server which we want to change but also want to have the email copy in lotus but not on this email mail file for various reason …

i did wrote an agent using lotus script and the agent works fine (runs on new mail arrival ) to copy all the document from one database to other database …the other database created is also a mail file but with diffrent name …i am using doc.copytodatabase(db2) syntax to acheive the result in the agent

The problem i face is the document is copied to the new database on a new mail arrival but it is seen in all document view …

i want this to be in inbox view /folder …

is there a way out to put some codes in the same agent

i do not want to run one more agent to move documents from all document view to inbox

is there a specific syntax in which i can directly put the doc in a particular folder across database …

doc.Putinfolder works fine within one database but not across database

hope some one helps me

thanks in advance

Venki

Subject: RE: copytodatabase

I would have said PutInFolder. How exactly are you doing this that doesn’t work? What happens when you try it? Please be specific and complete.

Subject: RE: copytodatabase

let me try to explain again i have 2 mail files say abc and abc1 …

i am in a mail file abc where the agent is running .

code 1:

the code is like this

on new mail arrival on abc

init database

init notesdoc

then for all doc’s in abc

doc.copyintodatabase (abc1)

move to next document of doc record pointer

loop ends

i tried the code in other way as well

code 2:

init 2 database both abc as well abc1

init 2 notesdocument doc1 for abc and doc2 for abc1

loop

code for copyallitems from doc1 to doc2

doc2.putinfolder($inbox)

move record pointer

i thought that the second code would work fine more than the first one

but it copies to all doc view in abc1 and puts it in inbox of abc

thats kind of funny behaviour

but logically should work but is n’t

any thought 's

As of now my agent is in code one as it do not duplicate in the first mail file

but i still have it in alldocument view of abc1 rather than inbox of abc1

hope i tried to explain well

thanks for your email

hope to get a reply

thanks in advace

Subject: RE: copytodatabase

Why do you post pseudocode and not the actual code you are using? You are not supplying the details I need to solve the problem.

The original document gets put into the inbox in the first database, because that’s what happens to mail when it’s received. Your agent is not causing that.

The copy document probably isn’t getting put into the folder because you failed to save it before trying to put it into a folder.

You should use CopyToDatabase, not CopyAllItems – that will be more efficient. Since CopyToDatabase also saves the new docuent, you should be able to call PutInFolder right after that. Of course the folder name must be in quotes, and the full correct name of the inbox folder is “($Inbox)”.

Subject: RE: copytodatabase

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Dim db2 As NotesDatabase

Dim doc As NotesDocument

Dim doc2 As NotesDocument

Set db = session.CurrentDatabase

Set db2 = New NotesDatabase("Villages01", "mail\EOR.nsf")

'Messagebox( "got db2  init " )

Call db.UpdateFTIndex(True)

Set dc = db.FTSearch("villages-mcc.org", 0)

Set doc = dc.GetFirstDocument

Set doc2=New  NotesDocument(db2)

'If doc.IsNewNote Then

 'Use the call statement because to return

 'value is needed

'	Call doc.CopyToDatabase(db2)

'Else

	'Messagebox( "This document has been saved. It's not new." )

'End If

While Not(doc Is Nothing)

 'Use the call statement because to return

 'value is needed

	'Set doc2=doc

	'If doc.IsNewNote Then

	Call doc.CopyToDatabase(db2)

	Messagebox( "This document has been saved. " )

	'Else

	'	Messagebox("This is old doc and not copied to EOR ")

	'End If

	'Call doc2.PutInFolder("$Inbox")

	Set doc = dc.GetNextDocument(doc)

Wend

End Sub

This is the code as of now i am running on a new mail arrival …

The new incoming mail is copied to EOR database and is in all document view

and i can’t put that in inbox view of EOR database …

hope now you got the problem …

clarification

i know that original document on a mail file goes in to the inbox …when i used copyallitems code after the pop3 download still i have the same mails in the inbox of database A as it has copied to database A inbox onemore time when the agent runs and not to database B

in the above code putinfolder doesn’t work as we directly copy this doc to database

and it is in all doc view instead of inbox as it is a copied item and not a new mail arrived

Subject: Try:

Set doc2 = doc.CopyToDatabase(db2)	Call doc2.PutInFolder("($Inbox)")

Subject: RE: Try:

Thanks Bill That works

really appreciate that

Thanks a lot