Code below is used as a Lotusscript based button on a kickoff form. This code creates an QPTool import xml file using a single column tab delineated text file as input. Option Declare Sub Click(Source As Button) Dim s As New NotesSession Dim w As New NotesUIWorkspace Dim uiDoc As NotesUIDocument ' front-end of current document ' this agent takes in a list of users and adds user to specified place Dim servername As String ' server name as known by qp Dim placename As String ' the place to add users. place must pre-exist Dim askme As Variant ' user prompt result Dim nam As NotesName ' a name being converted to dn format Dim namestr As String ' a name as string being added to XML code ' input file dims Dim infilename As String ' the path/name of import file to use Dim infileNum As Integer ' the free file handler number (LS supports 255) Dim fileexist As String ' test to see if the file exists before open ' output file dims Dim outfilename As String ' xml filepath/name as entered by user Dim outfileNum As Integer ' the free file handler number (LS supports 255) On Error Goto ErrorHandler On Error 4412 Goto TooBigHandler 'setup base environment Set uiDoc=w.CurrentDocument servername = uidoc.FieldGetText("Server") placename = uidoc.FieldGetText("Place") infilename = uidoc.FieldGetText("FilePath") ' test for place name entered If placename="" Then Msgbox("No place name entered. Cancelling... ") Exit Sub End If ' we need to load list from external delineated text file... ' get path/filename info from from form If infilename="" Then Msgbox "Unable to use your file path information...", , "Sorry" Exit Sub End If ' test entered path/filename fileexist = Dir$(infilename) If fileexist = "" Then ' it did not exist notify the user Msgbox "Unable to open file using the file info provided.", , "Sorry" Exit Sub End If ' we have success, lets begin writing code... ' get path/filename info from user askme = w.Prompt (PROMPT_OKCANCELEDIT, _ "Enter File Name", _ "Enter the full path and filename; include the .xml extension.", "c:\temp\filename.xml") If Isempty (askme) Then Msgbox "Unable to use your file path information...", , "Sorry" Exit Sub End If outfilename = Cstr(askme) ' create file for output ' get an unused file number so LotusScript can open a file. outfileNum = Freefile() ' self dims as integer ' open the file Open outfilename For Output As outfileNum ' write header to output file Call WriteXMLHeader(outfilenum, servername, placename) ' get an unused file number so LotusScript can open the file. infileNum = Freefile() ' self dims as integer ' open the file Open infilename For Input As infileNum ' loop and bring in each line While Not Eof(infileNum) ' read until End Of File Input #infileNum, namestr ' get 1st column in delineated file Set nam = New NotesName(namestr) namestr = ReplaceChar(nam.Canonical, "/", ",") ' write this person to output file Call WriteXMLPerson(outfilenum, namestr) Wend ' write footer of output file Call WriteXMLFooter(outfilenum, servername) ' close the files Close infileNum Close outfileNum Exit Sub Errorhandler: Msgbox "Error #" & Cstr(Err) & " - " & Error$,16,"Error!" Resume Next Exit Sub TooBigHandler: Msgbox "You have exceeded 64k worth of code. That is more than we can write.", 16, "Sorry" ' close the file Close infileNum Close outfileNum Exit Sub End Sub Function WriteXMLHeader(outfilenum As Integer, servername As String, placename As String) As Integer ' creates the upper structure part of the XML code ' (this code also uses an output file handler number already created) ' write the part of the xml file before we get to the user info Print #outfilenum, || & Chr$(13) Print #outfilenum, || & Chr$(13) Print #outfilenum, | | & Chr$(13) If servername="Local" Then ' structure for local Print #outfilenum, | | & Chr$(13) ' code executes on "this" server Else ' structure for specific server Print #outfilenum, | | & Chr$(13) Print #outfilenum, | | & servername & || & Chr$(13) End If Print #outfilenum, | | & Chr$(13) Print #outfilenum, | | & Chr$(13) Print #outfilenum, | | & placename & ||& Chr$(13) Print #outfilenum, | | & Chr$(13) WriteXMLHeader=1 End Function Function WriteXMLPerson(outfilenum As Integer, namestr As String) As Integer ' this function writes a person/group entry into the XML code ' (this code also uses an output file handler number already created) Print #outfilenum, | | & Chr$(13) ' formated: cn=Charles Brown,ou=Sales,o=ACME Print #outfilenum, | | & namestr & || & Chr$(13) Print #outfilenum, | | & Chr$(13) WriteXMLPerson=1 End Function Function WriteXMLFooter(outfilenum As Integer, servername As String) As Integer ' writes the close tags of the xml file after we add all the user info ' (this code also uses an output file handler number already created) Print #outfilenum, | | & Chr$(13) Print #outfilenum, | | & Chr$(13) Print #outfilenum, | | & Chr$(13) If servername="Local" Then ' structure for local - nothing needed with current syntax Else ' structure for specific server Print #outfilenum, | | & Chr$(13) End If Print #outfilenum, | | & Chr$(13) Print #outfilenum, || & Chr$(13) WriteXMLFooter=1 End Function Function ReplaceChar(origstring As String, subchar As String, newchar As String) As String ' takes an original string (origstring) and replaces all characters of subchar with newchar ' returns the modifed (if subchar was found) string back Dim szReturn As String ' the modified string to return Dim modstring As String ' inprogress modstring Dim index As Integer ' working variable showing where subchar is or is not in the origstring Dim sublen As Integer ' # of characters length of subchar modstring = origstring sublen = Len(subchar) index = Instr(1, modstring, subchar) If sublen = 0 Then ' we have a nothing subchar so lets just return the original string ReplaceChar = origstring Exit Function End If If (index = 0) Then ' subchar was not found in origstring so we can return the original string ReplaceChar = origstring Exit Function End If While index <> 0 szReturn = Left$(modstring, index - 1) szReturn = szReturn + newchar + Mid$(modstring, index + sublen) modstring = szReturn index% = Instr(1, modstring, subchar) Wend ReplaceChar = szReturn End Function