|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mick's travel tricks: miscellaneous tools for your traveling needs (continued)
This agent relies on the Folder References setup of the mail database. Check the Designer help for Notesdatabase.FolderReferencesEnabled, which explains the two hidden views that must be in the database for Folder References to work. These two views are always to be found in the Notes 5 mail file and can be copied from there to any database, and the agent can then be used in that database too.
vCard to Memo
vCard support in Notes has been, well, non-existent, up to Notes 6. Now Notes 6 (PR2) can create a personal directory entry directly from a vCard, which means that I throw away the code that I'd started, but not finished, to do just that. In Notes 6, you View a vCard file, and it parses the details straight into a personal address book entry and enables you to save it into your personal address book. Cool.
I have a Lotuscript agent that I modified from an original in the Notes.net Sandbox (at http://www-10.lotus.com/ldd/sandbox.nsf?OpenDatabase), which will write and add a vCard entry for me from information in my personal address book. Indeed, while checking the Sandbox as I wrote this article, I see that there are now other tools in there for reading and writing vCards. The code is as follows:
Sub Initialize
Dim session As New NotesSession
Dim international As NotesInternational
Set international = session.International
Dim workspace As New notesuiworkspace
Dim uidoc As notesuidocument
Dim books As Variant
Dim col As NotesDocumentCollection
Dim dateTime As New NotesDateTime("01/01/94")
Dim view As NotesView
Dim doc As NotesDocument
Dim bdoc As notesdocument
Dim done As Variant
Dim person As String
Set uidoc = workspace.currentdocument
books = session.AddressBooks
done = False
tmp$ = Environ$("TEMP")
If Right(tmp$,1) = "\" Then
tmp$=Left$(tmp$,Len(tmp$)-1)
End If
Forall b In books
If ( b.IsPrivateAddressBook ) And ( Not done ) Then
Call b.Open( "", "" )
Set col = b.Search("Form = ""Person"" & FullName = """+ session.UserName+ """",dateTime,0 )
Set doc = col.getFirstDocument
If Not ( doc Is Nothing ) Then
done = True
End If
End If
End Forall
If Not done Then
Messagebox _
( "Sorry, unable to locate your information." )
Else
fileNum% = Freefile()
Open tmp$+"\"+Lcase(Trim(doc.ShortName(0)))+".vcf" For Output As fileNum%
Print #fileNum%,"BEGIN:VCARD"
Print #fileNum%,"VERSION:2.1"
Print #fileNum%,"N:"+doc.FirstName(0) + " " + doc.LastName(0)
If doc.FullNameInt(0) <> "" Then
Print #fileNum%,"FN:"+doc.FullNameInt(0)
End If
If doc.OfficeStreetAddress(0) <> "" Then
Print #fileNum%,"ADR;WORK:;"+doc.OfficeStreetAddress(0)+";;"+doc.OfficeCity(0)+";"+doc.OfficeState(0)+";"+doc.OfficeZIP(0)+";"+doc.OfficeCountry(0)
End If
If doc.StreetAddress(0) <> "" Then
Print #fileNum%,"ADR;HOME:;"+doc.StreetAddress(0)+";;"+doc.City(0)+";"+doc.State(0)+";"+doc.ZIP(0)+";"+doc.Country(0)
End If
If doc.PhoneNumber(0) <> "" Then
Print #fileNum%,"TEL;HOME:"+doc.PhoneNumber(0)
End If
If doc.FaxPhoneNumber(0) <> "" Then
Print #fileNum%,"TEL;HOME;FAX:"+doc.FaxPhoneNumber(0)
End If
If doc.OfficePhoneNumber(0) <> "" Then
Print #fileNum%,"TEL;WORK:"+doc.OfficePhoneNumber(0)
End If
If doc.OfficeFaxPhoneNumber(0) <> "" Then
Print #fileNum%,"TEL;WORK;FAX:"+doc.OfficeFaxPhoneNumber(0)
End If
If doc.CellPhoneNumber(0) <> "" Then
Print #fileNum%,"TEL;CELL:"+doc.CellPhoneNumber(0)
End If
If doc.FullName(0) <> "" Then
Print #fileNum%,"EMAIL;INTERNET:"+doc.FullName(0)
End If
Print #fileNum%,"TZ:"+Cstr(international.timeZone)
If doc.JobTitle(0) <> "" Then
Print #fileNum%,"TITLE:"+doc.JobTitle(0)
End If
If doc.CompanyName(0) <> "" Then
Print #fileNum%,"ORG:"+doc.CompanyName(0)+";"+doc.Department(0)+";"+doc.Location(0)
End If
m$ = Cstr(Month(Date$))
If Len(m$) = 1 Then
m$ = "0"+m$
End If
d$ = Cstr(Day(Date$))
If Len(d$) = 1 Then
d$= "0" + d$
End If
h$ = Cstr(Hour(Time$))
If Len(h$) = 1 Then
h$ = "0" + h$
End If
mi$ = Cstr(Minute(Time$))
If Len(mi$) = 1 Then
mi$ = "0" + mi$
End If
s$ = Cstr(Second(Time$))
If Len(s$) = 1 Then
s$ = "0" + s$
End If
rev$ = Cstr(Year(Date$))+m$+d$+"T"+h$+mi$+s$
Print #fileNum%,"REV:"+rev$
Print #fileNum%,"END:VCARD"
Close #fileNum%
Set bdoc = uidoc.document
Set rtitem = New NotesRichTextItem( bdoc, "Body" )
Call rtitem.EmbedObject ( EMBED_ATTACHMENT, "", tmp$+"\"+doc.ShortName(0)+".vcf", "vCard" )
Kill tmp$ +"\"+doc.ShortName(0)+".vcf"
Messagebox("vCard Added successfully")
End If
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Advertisement --
Sophisticated Meets Simple For Document Management
Share. Control. Manage.
Documents, emails, and content in the context of how work is done.
Native to Lotus Domino. The User Experience unseen for Lotus Domino.
Do more with less. Really.
See the possibilities Docova unleashes for Lotus Domino. |
-- Advertisement --
Integrate your Notes Applications with Microsoft Office and Symphony
Integra for Notes Integrates Microsoft Office and/or IBM Lotus Symphony
Requires NO change to the design of the appliation or Installations of DLL's and EXE's
- Integra is a ready to use solution, enhance static reports with Excel data analysis, pivot tables, macros
- User friendly aproach, using a point and click access to features
- Reports from any Lotus Notes databases
- Runs reports through a Notes client, web browser and scheduled basis
- Allows use of LotusScript for advanced data manipulation
- Enables self service reporting capabilities to end-users
Learn more at www.integra4notes.com. |
|
|
|
|
|
|
|
|
|
|