Agent To Export Address Book Info In Palm Format

Here is a Lotus script agent that will extract information from the name & address book into a comma separated file with quotes around the data (appropriate for importing into a palm pilot). It consists of two subroutines - initialize and format_output. In order to be used, it will need to be put into the name & address database as a shared agent. An alternative for the impatient is to make a local copy of the name & address book (Don't...

copy the ACL.), and put the agent in yourself. As it is currently written, the agent must be run from a view. When you run it, it tells you what it is about to do and asks whether you would like to continue or not. It uses a view called "Quick Phone List", which you can change to any person view in the NAB. Sub Initialize Dim FileNum As Integer Dim FileName As String Dim oneLine As String Dim session As New Notessession Dim ws As New NotesUIWorkspace Dim db As NotesDatabase Dim view As NotesView Dim doc As NotesDocument ' Set the output file number and name FileNum = Freefile() FileName = "C:\Temp\phone.csv" Dim boxType As Long, answer As Integer boxType& = MB_YESNO + MB_ICONQUESTION answer% = Messagebox("This will export from the Name & Address book to the file: " + FileName + ". Do you want to continue?", 0 + 33, _ "Continue?") If answer% = 2 Then Messagebox "Palm Pilot Export agent has been cancelled at your request ", 0 + 16, "Agent Cancelled" Exit Sub End If Set db = session.CurrentDatabase Set view = db.GetView("Quick Phone List") Set doc = view.GetFirstDocument Open FileName For Output As FileNum While Not (doc Is Nothing) Call Format_Output(doc, oneline) Print #FileNum, oneline Set doc = view.GetNextDocument(doc) Wend Close FileNum Messagebox "Export to " + FileName + " is complete.", 64, "Palm Pilot Export Agent Success" End Sub Sub Format_Output (doc As notesdocument, oneline As String) ' NOTE: The "record layout" for the Palm device is as follows: ' Last, First, Title, Company, WorkPhone, HomePhone, Fax, Other, email, Address, city, state, xip, country, custom1, custom2, custom3, custom4, note, private, category ' The corresponding fields from notes are: ' LastName, FirstName, JobTitle, CompanyName, OfficePhoneNumber, PhoneNumber, OfficeFaxPhoneNumber, Cellular, DisplayMailAddress, Location ' I have inserted place holders for city, state, zip, and country so the custom 1 - 4 fields will line up properly as project, projectlocation, projphone,projfaxphone. ' I also added placeholders for the last two fields, Private, and Category. ' Note: certain fields have if statements to check for data - it is vital that something gets written out as a placeholder, whether there is data or not, so all the fields line up correctly. ' The output string is built as we go along in case there is any trouble with a particular field, it will be obvious which one it is. Dim Q, C As String Dim xx, yy As Variant Q = """" C = "," ' Last Name xx = doc.LastName oneline = Q + xx(0) + Q + C + Q ' First Name xx = doc.FirstName oneline = oneline + xx(0) + Q + C + Q ' Job Title xx = doc.JobTitle oneline = oneline + xx(0) + Q + C + Q ' Company xx = doc.CompanyName oneline = oneline + xx(0) + Q + C + Q ' Work Phone xx= doc.OfficePhoneNumber oneline = oneline + xx(0) + Q + C + Q ' Home Phone xx= doc.homephonenumber oneline = oneline + xx(0) + Q + C + Q ' Fax xx= doc.OfficeFaxPhoneNumber oneline = oneline + xx(0) + Q + C + Q ' Other ' Note - since there could be mutliple values here, I built the field sepparately before appending it to the output line xx= doc.Cellular yy = doc.Pager Other = "" If xx(0) > "" Then Other = "Cell: " + xx(0) End If If yy(0) > "" Then Other = Other + " Pager: " + yy(0) End If If Other > "" Then oneline = oneline + Other + Q + C + Q Else oneline = oneline + Q + C + Q End If ' Email yy=doc.FirstName zz=doc.LastName oneline = oneline + yy(0) + "." + zz(0) + "@iiginc.com" +

This was first published in November 2000

Dig deeper on Domino Resources - Part 2

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.UK

Close