0
votes
Sub Initialize

On Error GoTo e
Dim session As New NotesSession, db As NotesDatabase, view As NotesView
Dim nvec As NotesViewEntryCollection
Dim c As integer
Set db = session.currentdatabase

Set view = db.getView("Locked Out Users")
Set nvec = view.Allentries

c = nvec.count

If c > 0 Then

Call nvec.Removeall(true)

' Send notification
Dim sarr(1) As String
sarr(0) = "[email protected]"
sarr(1) = "[email protected]"

Dim mdoc As NotesDocument, rt As notesrichtextitem
Set mdoc = db.createdocument
mdoc.Form = "Memo"
mdoc.Subject = "Removed " + CStr(c) + " Locked out users on mypage"
Set rt = mdoc.Createrichtextitem("Body")
Call rt.Appendtext("Removed " + CStr(c) + " Locked out users")
Call rt.Addnewline(1) 
Call rt.Appendtext("Click to open lockout database")
Call rt.Appenddoclink(db,"Lockout")
Call mdoc.Send(False, sarr)

End If
Exit Sub
e:
Print Error,erl
End Sub

I’m a beginner in Lotus Domino it I have some question , It's possible to change this script to delate only locked users with specified name?

I added something like that:

 Dim nam As NotesName
Dim c As integer
Set db = session.currentdatabase
Set nam.OrgUnit1 = (“GD”)
Set view = db.getView("Locked Out Users")
Set nvec.OrgUnit1 = view.Allentries

c = nvec.count

If c > 0 Then

In my case I need delete all group person how has specified dc, for example Robert Kowalski/GD/Company everybody how has in name dc=GD?

2
FYI "GD" is not a "dc" in the Lotus world. It is an "Organizational Unit", or "OU". - Richard Schwartz

2 Answers

0
votes

There are at least 2 ways to achieve your request. First you can copy the view "Locked Out Users" and change the selection formula to only include your OU.
The other option is something like

dim doc as notesdocument
dim nextDoc as notesdocument

set doc = view.getfirstdocument()
while not doc is nothing
 set nextDoc = view.getnextDocument(doc)
 set nam = new notesname(doc.getItemValue("[NAMEITEM]")(0))
 if strcompare(nam.orgUnit1,"GD",5)=0 then
  call doc.remove(true,false)
 end if
set doc = nextDoc 
wend
0
votes
    Sub Initialize

On Error GoTo e
Dim session As New NotesSession, db As NotesDatabase, view As NotesView
Dim nvec As NotesViewEntryCollection
Dim c As integer
Set db = session.currentdatabase
dim doc as notesdocument
dim nextDoc as notesdocument

set doc = view.getfirstdocument()
while not doc is nothing
 set nextDoc = view.getnextDocument(doc)
 set nam = new notesname(doc.getItemValue("[NAMEITEM]")(0))
 if strcompare(nam.orgUnit1,"GD",5)=0 then
  call doc.remove(true,false)
 end if
set doc = nextDoc 
wend

Set view = db.getView("Locked Out Users")
Set nvec = view.Allentries

c = nvec.count

If c > 0 Then

Call nvec.Removeall(true)

' Send notification
Dim sarr(1) As String
sarr(0) = "[email protected]"
sarr(1) = "[email protected]"

Dim mdoc As NotesDocument, rt As notesrichtextitem
Set mdoc = db.createdocument
mdoc.Form = "Memo"
mdoc.Subject = "Removed " + CStr(c) + " Locked out users on mypage"
Set rt = mdoc.Createrichtextitem("Body")
Call rt.Appendtext("Removed " + CStr(c) + " Locked out users")
Call rt.Addnewline(1) 
Call rt.Appendtext("Click to open lockout database")
Call rt.Appenddoclink(db,"Lockout")
Call mdoc.Send(False, sarr)

End If
Exit Sub
e:
Print Error,erl
End Sub

Thank You @umeli for Yours responce. I think now it should work.