Hello everybody,I found this article at:
http://www-10.lotus.com/ldd/today.nsf/Lookup/Customizing_QuickPlace
regarding a bot that adds users to quickplace from a file. At the very beginning of the code 4 pieces of information need to be entered –
the path to the quickplace, the quickplace name, the input file name, and the server name. I thought I had entered these items correctly but I’m not getting the desired results. Furthermore, I don’t even know if that’s what’s causing the bot to not work. Has anyone else tried using this bot? If so, did you get it to work? What format do the four pieces of information need to be in?
Here’s the code:
Sub Initialize
'Reads user data from file in the following format: username, password, [reader|author|manager]
'User must enter path to quickplace, quickplace name, data file and server when agent is run
DirName$ = Inputbox(“Enter path to quickplace (e.g., c:\quickplace)”)
QPName$ = Inputbox(“Enter quickplace name”)
DataFile$ = Inputbox(“Enter input file name (must be in data directory)”)
Server$ = Inputbox(“Enter server name”)
Dim ContactsDb As New notesdatabase ( “”, DirName$ + "\data\quickplace" + QPName$ + “\contacts1.nsf”)
Dim MainDb As New notesdatabase ( “”, DirName$ + "\data\quickplace" + QPName$ + “\main.nsf”)
Dim NamesDb As New notesdatabase (“”, DirName$ + “\data\names.nsf”)
Dim MainACL As notesacl, ContactsACL As notesacl
Dim Entry As notesaclentry
Dim View As notesview
Dim MemDoc As notesdocument, Doc As notesdocument
Dim Item As notesitem
0 'data file
FileNum% = Freefile()
FileName$ = DirName$ + "\data" + DataFile$
RestOfSysName$ = “/OU=” + QPName$ + “/OU=QP/O=” + Server$
RestOfACLName$ = “/” + QPName$ +“/QP/” + Server$
'get handle on h_Members group in the NAB
Set View = NamesDb.getview(“Groups”)
Set MemDoc = View.getdocumentbykey(“h_Members/” + QPName$)
Set Item = MemDoc.getfirstitem(“Members”)
Open FileName$ For Input As FileNum%
Do Until Eof(FileNum%)
Input #FileNum%, UserName$, Password$, Level$
0 Set Doc = New notesdocument (ContactsDb)
’
'assign field values
Doc.h_Type = “h_Member”
Doc.h_Name = UserName$
Doc.h_SystemName = “CN=” + UserName$ + RestOfSysName$
Doc.h_Password = Password$
Doc.h_IsPublished = “1”
Doc.h_IsHidden = “1”
Doc.h_SetReadScene = “h_MemberRead”
Doc.h_SetEditScene = “h_MemberEdit”
’
'save so that h_Password has a value
Call Doc.save (True, True)
’
'hash password and resave
NotesMacro$ = “@Password(h_Password)”
Doc.h_Password = Evaluate(NotesMacro$, Doc)
Call Doc.save (True, True)
’
'make users reader, author or manager and set ACLs appropriately in main.nsf and contacts1.nsf
Set MainACL = MainDb.acl
Select Case Level$
Case “reader”:
Set Entry = MainACL.createaclentry (UserName$ + RestOfACLName$, ACLLEVEL_READER)
Case “author”:
Set Entry = MainACL.createaclentry (UserName$ + RestOfACLName$, ACLLEVEL_AUTHOR)
Entry.ispublicwriter = True
Case “manager”:
Set Entry = MainACL.createaclentry (UserName$ + RestOfACLName$, ACLLEVEL_MANAGER)
Entry.candeletedocuments = True
’
'managers must be added to contacts1.nsf ACL as well
Set ContactsACL = ContactsDb.acl
Set Entry = ContactsACL.createaclentry (UserName$ + RestOfACLName$, ACLLEVEL_MANAGER)
Entry.candeletedocuments = True
Call ContactsACL.save
End Select
Call MainACL.save
’
'all users must also be added to the h_Members group in names.nsf
Call Item.appendtotextlist(“CN=” + UserName$ + RestOfSysName$)
Call MemDoc.save (True, True)
Loop
Close FileNum%
End Sub