How Do I Check for Unprocessed/Unread?

How Do I check for Unprocessed/unread
documents in a Mail Database?

I'm running an agent on the server and
this agent is suppose to read each and every user's mail boxes "Sent" folder mails and send it to the respective receipients.

I'm using Lotus Script in my Agent to do this. The problem is that i'm unable
to find a "Flag" to mark in all the documents that the agent has run on :(

I can't use :

"Set db = session.CurrentDatabase
Set collection = db.UnprocessedDocuments"

as my db is the database which is running the agent, hence this option is off... :(

I'm using db and db1..

"Set db = directory.getfirstdatabase (DATABASE)
     While Not (db Is Nothing)
          If db.title = B Then
               Set db1 = s.getdatabase("XYZ", db.filePath)                                        
              Set view = db1.GetView("($Sent)")                            
               Set doc = view.GetFirstDocument....."                                
As you can see db1 holds the value of the respective mail box databases names. As you can see db1 uses the "getdatabase" method
hence I can't use the 'UnprocessedDocument"Property( as this is not one the getdatabase property.

Can anyone suggest another way of doing this...Pls help

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi monn,

why cann't you use

set coll = db1.unprocesseddocuments

because db1 is the mail database now and u can apply the unprocesseddocuments property.

good luck,
monnAuthor Commented:
Edited text of question.
Hi monn,

why don't you just set a field on each document that you have processed? When you run through just check for this field.
monnAuthor Commented:
Dear Srandrews,

I'm sorry but I can't accept your answer as I'm running this on the
Domino server and on all the mails of the different users mail box.

I do not want to touch the "Memo" Form
in the database.Hence I don't wanna create an extra field in each of the mails as it might create problems later, when the user tries to open his/her mails.

Anyway thanks for your answer. Can you please suggest a solution as to use the
"UnprocessedDocument" Property, so that
I can use the in built property.

Thank you.

Dear Antonysingh,

I got the following message when I tried using the :

"set coll = db1.unprocessedDocuments"

The message is :

"Can't get left to-do-list,
 Database XYZ!!abc.nsf is not the
 agents database"

Note :

 XYZ & abc.nsf is not the actual server
 and mail database names. I cannot put  
 the actual names for security reasons.
 Sorry. But the message is the actual
 message I got when i ran the agent.

Urgent..Pls help...
You should have accepted the answer from srandrews.  He did not mention anything about editing the memo form itself, and there would be no need to do so.  Adding a field on a DOCUMENT and checking a field on a DOCUMENT are completely independent of the memo form itself.

The only real concern with this is that as you mark these documents with your agents, the documents have now changed and will show up as "unread" to the users.  But that should be of little concern when dealing with documents in a "sent" folder, since they are relatively seldomly viewed by the users.

So, without touching the memo form design, just use code like this:
if not doc.hasItem("ProcessedByMyAgent") then
'  process it
'  <your code here>
' now mark it
    doc.processedbymyagent = "Yes", false)

    'do nothing - it was already processed
end if

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.