2017-03-06 66 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爲你的性反應。我認爲現在 它應該工作。