2017-03-06 92 views
0
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 

我是Lotus Domino的初学者它我有一些问题,可以将此脚本更改为仅限定具有指定名称的锁定用户吗?莲花脚本锁定用户

我补上一句说:

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 

在我来说,我需要删除所有组的人是如何规定的DC,例如罗伯特·科瓦尔斯基/ GD /公司大家如何在名称DC = GD?

+0

仅供参考莲花世界中的“GD”不是“dc”。它是一个“组织单位”或“OU”。 –

回答

0

至少有两种方法可以实现您的请求。 首先您可以复制视图“锁定用户”并更改选择公式以仅包含您的OU。
另一种选择是一样的东西

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
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 

谢谢@umeli为你的性反应。我认为现在 它应该工作。