If you are not 100% comfortable as a LotusScript
developer, and as per the previous response, a consultant could tailor
the agent exactly for your business and needs. It would save time,
but would cost a little bit (probably not much money, since the code for
this wouldn't be difficult to write - maybe 30 minutes to an hour, including
testing - for an experienced developer?).
However, if you are trying to do this
on your own, at least LotusScript is pretty intuitive. You are asking
to do a lot of different things in the same agent, and there's probably
not a sample piece of code publically available that actually does all
3 tasks. But if you can find snippets that do each of those tasks
separately, then all you have to do is put it all together into one agent.
The questions posed in the previous
response are necessary, in order to get to the final product. The
implementation of the code (either manual vs. scheduled agent) affects
the code used to get handle to documents/document context. Also,if
you want to save the attachment to a server vs. local machine, the code
and agent properties for this are also slightly different. In order
to save them to the server, with Domino running as a service, the agent
signer and server will need higher Domino programmability rights and certain
OS account rights to achieve that.
When searching for sample code, half
the battle is knowing what to search for. I search for the specific
methods/properties. Perhaps that approach would help you as well?
I would also suggest looking at the all the forums (including Notes
6&7) for sample code. Search each forum for just the individual
method, and you usually find a bunch of sample code, just maybe not all
of these together in the same agent:
Task:
LotusScript class:
Method to use:
1.) Save an attachment to
hard drive
NotesEmbeddedObject
ExtractFile
*2.) Mark the document as read
NotesDocument
MarkRead
3.) Archive
NotesDocument
CopyToDatabase
/ Remove OR RemovePermanently (hard delete)
*Note about MarkRead method: Keep
in mind that there is a different unread id table for each user of this
db. How the doc gets marked read depends on the person who signed the agent
(if it's a scheduled agent) or the person who triggers the agent manually.
If the agent signer is a different person than the person who owns
the mail file, then the doc gets marked Read for the agent signer, not
the mail file owner, and it will not show up as read when the owner looks
at it.
That said...
1.) The code in this technote shows
you how to get handle to the specific doc, to the attachments within
it, and how to detach ("extract" them to the local hard drive
(the machine executing the code) - you just don't go so far as to move
the attachment to the other field. Skip the first 2 parts of the
loop, and focus on the object type of ATTACHMENT. This code also assumes
you are selecting different documents in a view, and using the actions
menu to trigger the agent:
Title: Using
LotusScript to move attachments or objects from one field to another
Doc #: 1109976
URL: http://www.ibm.com/support/docview.wss?uid=swg21109976
2.) The Domino designer Help has
a decent example of the MarkRead method, although there is a bunch of stuff
you would not need (you don't necessarily need to return all read/unread
documents):
Examples: MarkRead
method
This agent displays the number of unread documents in a
view, marks the first document as read, then displays the new number of
unread documents in the view.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim vec As NotesViewEntryCollection
Dim ve As NotesViewEntry
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set view = db.GetView("All")
Set vec = view.GetAllUnreadEntries()
Messagebox vec.Count,, "Original
unread documents"
Set ve = vec.GetFirstEntry()
Set doc = ve.Document
Call doc.MarkRead()
Set vec = view.GetAllUnreadEntries()
Messagebox vec.Count,, "Unread
documents after MarkRead"
End Sub
3.) Using CopyToDatabase: If
you are already registered with searchdomino, there is a lot of helpful
code on that website, for example:
http://searchdomino.techtarget.com/tip/Archiving-CopyToDatabase-method-with-child-documents
Basic example of copytodatabase: http://www-12.lotus.com/ldd/doc/lotusscript/lotusscript.nsf/1efb1287fc7c27388525642e0074f2b6/a8772db4145e1c4d8525642e00756342?OpenDocument
Basic example of remove: http://www-12.lotus.com/ldd/doc/lotusscript/lotusscript.nsf/1efb1287fc7c27388525642e0074f2b6/17eb2da5ce6f779b8525642e0076d245?OpenDocument
This one does too much, but it does
show how to copy docs from 1 db to another:
Title: How
to copy all documents and folders from one mail database to another using
LotusScript
Doc #: 1110903
URL: http://www.ibm.com/support/docview.wss?uid=swg21110903
Just watch out for this possible error:
Title: Executing
attachment actions with certain documents results in error 'Attachment
has been modified or corrupted since signed!'
Doc #: 1192728
URL: http://www.ibm.com/support/docview.wss?uid=swg21192728
Finally, here is a custom archive type
of agent:
Title: How
to purge messages in Sent view older than a certain number of days
Doc #: 1202779
URL: http://www.ibm.com/support/docview.wss?uid=swg21202779
Hopefully this helps and is not too
overwhelming....