|
Here is how I accomplish the same task for my website. In Domlog.nsf, add a field to the 'Request' form called 'Updated' Create a view called 'Logins' with the following selection criteria: (@Contains(Request;"?Login")) & (!@xxxxxxxx(Updated;"Updated")) - This way, it will only show requests that contain logins. An agent will use the Updated field later. Add any other criteria as needed. I then have the following agent run ever 15 minutes. What it will do is go through the above view of logins, get the Authenticated User, search for them in the Address Book, and add the date to a field I created on the Person form. **Begin Agent** Sub Initialize Set session = New NotesSession Set db = session.CurrentDatabase server$ = "yourserver" dbfile$ = "youraddressbook.nsf" Dim db2 As New NotesDatabase( server$, dbfile$ ) Dim collection As NotesViewEntryCollection Dim view As NotesView Dim view2 As NotesView Dim doc As NotesDocument Dim entry As NotesViewEntry Dim docview As NotesDocument Dim namelist As String Dim docMail As NotesDocument Dim rtitem As NotesRichTextItem Set docMail = New NotesDocument(db2) Set rtitem = New NotesRichTextItem(docMail, "Body" ) Set view2 = db.GetView("Logins") Set view = db2.GetView("ByFullName") Set collection = view2.AllEntries Set entry = collection.GetFirstEntry Set doc = entry.document While Not entry Is Nothing Set doc = entry.document Set docview = view.GetDocumentByKey(doc.AuthenticatedUser(0),True) If docview Is Nothing Goto notfound docview.LastLogin = Now Call docview.Save(True,False) notfound: doc.Updated = "Updated" 'Here is that Updated field as described above. Call doc.Save(True,False) Set entry = collection.GetNextEntry(entry) Wend End Sub ***End Agent*** After this is done. The document will no longer show in the Logins view of domlog.nsf because of the field 'Updated'. Next is an agent that runs in the Address Book and removes those accounts that havent logged in for 90 days. Also removes them from any groups. ***Begin Agent*** Sub Initialize server$ = "yourserver" dbfile$ = "youraddressbook.nsf" Dim db As New NotesDatabase( server$, dbfile$ ) Dim view As NotesView Dim doc As NotesDocument Dim docMail As NotesDocument Dim compdate As Variant Dim rtitem As NotesRichTextItem Dim status As String Dim errormess$ Dim fullname As String Timecheck = Today - 90 Dim docsdeleted As Integer docsdeleted = 0 'group Dim dbGroup As New NotesDatabase( server$, "names.nsf" ) Dim collection As NotesDocumentCollection Set v = dbGroup.GetView("Groups") Dim docGroup As NotesDocument Dim dateTime As New NotesDateTime("nothing") Set session = New NotesSession Set view = db.GetView("ByUserName") Set docweb = session.DocumentContext Set docMail = New NotesDocument(db) Set rtitem = New NotesRichTextItem(docMail, "Body" ) Set doc = view.GetFirstDocument While Not ( doc Is Nothing ) compdate = doc.LastLogin(0) If compdate < Timecheck Then fullname = doc.FullName(0) Call doc.Remove(True) deletedDoc = 1 docsdeleted = docsdeleted + 1 'Removal from group(s) searchFormula$ = "Form = ""Group"" & (@Contains(Members;fullname))" Set collection = dbGroup.Search(searchFormula$,dateTime,0) For i = 1 To collection.Count Set docGroup = collection.GetNthDocument(i) docGroup.Members = Evaluate(|@Trim(@Replace(Members;"| & fullname & |";""))|,docGroup) Call docGroup.Save(True,False) Next End If If deletedDoc = 1 Then Set docm = view.GetFirstDocument deletedDoc = 0 Else Set doc = view.GetNextDocument(doc) End If Wend 'This will send an e-mail with a list of the accounts removed.(optional) Call rtitem.AppendText(docsdeleted & " Account Documents Removed." & Chr$(13) & Chr$(10)+ Today) docMail.Subject = "Account Removal Agent" Call docMail.Send(False,"emailaddress") End Sub That's it. There may be a much better way to do it, but this works for me. Regards, Jeremy S. rob@xxxxxxxxx Sent by: To: Lotus Domino on the iSeries / AS400 <domino400@xxxxxxxxxxxx> domino400-bounces@xx cc: drange.com Subject: Last sign on date 04/15/2003 02:43 PM Please respond to Lotus Domino on the iSeries / AS400 Is there such a field in the NAB? Trying to reduce user licenses if it isn't being used. Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin _______________________________________________ This is the Lotus Domino on the iSeries / AS400 (Domino400) mailing list To post a message email: Domino400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo.cgi/domino400 or email: Domino400-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/domino400.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.