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