[NotesAdministrationProcess] Questions about best practices

I’m working on a project where I need to automate user and mail file deletion. (We are handling 15 000 student accounts so anything manual isn’t feasible.)

My plan to solve this is in two parts. Like this.

First I create an adminp job that removes the user (with DeleteUser). I get the note id for the created job as a return value. I use that id to get a handle on the job in the admin4 database. I then mark the document with a special flag field (‘ORG-flag’ in the example below). I do that so I can find the requests that my code has initiated.

Code fragment (from test code):

Set adminp = ses.CreateAdministrationProcess(“Acme/Server/ORG”)

nid = adminp.DeleteUser(user.GetItemValue(“FullName”)(0), True, 2, “”)

Set doc = adminDb.GetDocumentByID(nid)

Call doc.ReplaceItemValue(“ORG-flag”, “Y”)

Call doc.Save(False, False)

The second part of the solution is a scheduled agent that opens the admin4 database and checks the “Pending By Age” view. The agent checks for each document if it’s parent (as found in the ‘ProxyOriginatingRequestUNID’ field) has the flag field set (‘ORG-flag’). If the parent has the field set then agent checks if the request is of the right type (as defined in the ‘ProxyAction’ field). If it is, then the appropriate approve method of the NotesAdministrationProcess class is called.

Code fragment (from test code):

Set adminpDb = New NotesDatabase(“Acme/Server/ORG”, “admin4.nsf”)

Set adminp = ses.CreateAdministrationProcess(“Acme/Server/ORG”)

Set pending = adminpDb.GetView(“PAAByAge”)

Set nextDoc = pending.GetFirstDocument

While Not(nextDoc Is Nothing)

Set pendingDoc = nextDoc

Set nextDoc = pending.GetNextDocument(nextDoc)

parentUnid = pendingDoc.GetItemValue(“ProxyOriginatingRequestUNID”)(0)

Set parentDoc = adminpDb.GetDocumentByUNID(parentUnid)

If Not(parentDoc Is Nothing) Then

  flag = parentDoc.GetItemValue("ORG-flag")(0)

  action = pendingDoc.GetItemValue("ProxyAction")(0)

  If flag = "Y" And action = "22" Then

     nid = adminp.ApproveMailFileDeletion(pendingDoc.NoteID)

  End If

End If

Wend

So. If there are any NotesAdministrationProcess experts out there. Is this solution OK, or has I overlooked something crucial? Any comments are appreciated.

Subject: Mail files

Is a mail file stored on a single server, or replicated to other servers?

Subject: Mail files

The mail file is replicated to two (2) servers. Thats why I use 2 parameter with the DeleteUser method. From the help: “MAILFILE_DELETE_ALL (2) deletes the mail file on the user’s home server and all replicas”.

The code works in my test environment (which I really should have mentioned in the original post). The code successfully approves the two deletion requests that is generated for the two mail replicas.

The thing that worries me is the part where I re-save the created administration request. Can this in any way corrupt the request and is there a possibility that the adminp process may start processing the request before I have time to resave it (in a worst case scenario). Or is there a “time buffer” before new requests are processed.