Smart Tool to Configure and Switch additional user in Notes Client

Dim session As New NotesSession
	Dim wk As New NotesUIWorkspace
	Dim doc As NotesDocument
	Dim db As NotesDatabase
	Dim dbNAB As NotesDatabase
	Dim dbCurrent As NotesDatabase
	Dim newloc As String
	Dim MailFile As String
	Dim MailFilePerson As String
	Dim viewPeople As NotesView
	Dim nnUserName As NotesName
	Dim docPerson As NotesDocument
	newLoc = session.Commonusername
	Set dbCurrent = session.CurrentDatabase	
	Set db = session.Getdatabase("", "names.nsf", False)

	Set dbNAB=session.Currentdatabase
	
	Set viewPeople = dbNAB.GetView("($VIMPeople)")
	Set nnUserName = New NotesName(session.UserName)
	Set docPerson = viewPeople.GetDocumentByKey(nnUserName.Abbreviated)
	
	MailFilePerson = docPerson.MailFile(0)

If LCase(Right$(MailFilePerson, 4)) <> ".nsf" Then
       MailFilePerson = MailFilePerson & ".nsf"
	End If

	Set doc = New NotesDocument(db)
	doc.Form = "Location"
	doc.Type = "Location"

	doc.Name = newLoc

	doc.MailFile = MailFilePerson
	doc.MailServer = docPerson.MailServer(0)
	doc.Domain = docPerson.MailDomain(0)
	doc.ImailAddress=docPerson.InternetAddress(0)
	
	Call doc.Computewithform(False,False)
	Call doc.save(False,False,False)
	Call wk.Locationsrefresh()
	Call wk.Setcurrentlocation(newLoc)
	Call wk.Opendatabase(docPerson.MailServer(0), MailFilePerson)





This tool creates the location document by fetching the current user details based on the ID he is login and fills all the necessary fields, switches the location
document to the newly created location document and opens the user's mail file.

Steps :

Open Domino Directory (Names.nsf)
Create a Lotus Script agent and paste the above code.
Set Target as 'None' in Agent properties.

From Notes Client :

Switch to the new user id and provide credentials.
Open Domino Directory and run the agent from Action menu.

LotusScript
Sudhakar K Reddy
September 22, 2016 5:08 AM
Rating
5

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.



No comments yetLogin first to comment...