We run the following agent in our address book on newly created or modified documents.
When a new user is created we store the id file in the address book, this agent then runs on the newly created docuement and sends this id file to a mail in database.
However, this only works if you create the user with a Notes 4 client. If a 5 or 6 client is used the agent does not run. If I run this agent manually on a document that has been created in R5/ R6 it works.
Any ideas???
Sub Initialize
'The purpose of this agent is to run against all newly created documents, take a copy of their id file and mail it to the ID deposit database
Dim session As New NotesSession
Dim thisdb As NotesDatabase
Dim newdocs As NotesDocumentCollection
Dim sourcefile As notesembeddedobject
Dim targetfile As NotesEmbeddedObject
Dim escrowdoc As notesdocument
Dim currentdoc As NotesDocument
Dim idfile As notesitem
Dim filename As String
Dim rtitem As NotesRichTextItem
Dim x As Integer
Dim path As String
path = “/lotusdata/user.id”
'path = “E:\temp\user.id”
Set thisdb = session.CurrentDatabase
Set newdocs = thisdb.UnprocessedDocuments
For x = 1 To newdocs.Count
Set currentdoc = newdocs.GetNthDocument( x )
If currentdoc.hasitem(“$FILE”) Then
Set idfile = currentdoc.GetFirstItem ( “$File” )
fileName = idfile.Values(0)
Set sourcefile = currentdoc.GetAttachment ( fileName )
Set escrowdoc = New notesdocument(thisdb)
Set rtitem = New NotesRichTextItem( escrowdoc, “Body” )
Call sourcefile.extractfile(path)
Set targetfile = rtitem.EmbedObject ( EMBED_ATTACHMENT, “”, path)
Kill path
rtitem.values = " Password Unknown"
escrowdoc.Form = “Memo”
escrowdoc.SendTo = “Escrow Agent”
escrowdoc.Subject = currentdoc.fullname
Call escrowdoc.send(False,“Escrow Agent”)
End If
Call session.UpdateProcessedDoc( currentdoc )
Next
End Sub