During the process of upgrading 5.0.10 clients to 6.5.2, the personal address book has not been upgraded. Most users still have the version 5 design. I wrote some LS to run a convert on the address book depending on the users current Notes client version. If they are currently using the Version 5 client the script exits and does nothing. If the template version of the address book starts with 6.5 it does nothing. If the template vers of the nab does not start with 6.5 and the user has the 6 client, I want to run the nconvert on the address book.
The version 6 template is in the users program directory where it belongs. I think the old address book was being copied over after the 6 client was installed. Running a replace design fixes the issue but I do not want to involve the end users for apparent reasons.
Here are the two issues I am having:
User that have been upgraded to 6.5.2 that stiil have the Version5 address book do not have a $TemplateBuild. It is blank if you look in the names.nsf properties. When the script runs it does not do anything because it does not find it.
QUESTION 1.How can I determine if it is blank and run the convert.
QUESTION 2. The nconvert runs fine for me as I am an admin and developer with rights on the server and admin right on my PC. It seems that when the NCONVERT.exe is started via the Shell in the script, the user is prompted for a password and it does not run. What do I need to do to get the nconvert to run withour any user intervention.
I am putting this script into the iNotes6 template in a queryopen on a custom form that starts when the client is open.
I have searched the forum for two days looking for a solution to these 2 questions with no avail.
I did find a C API script but I am not familiar with the C API and I could not get it to work.
Please help
Thanks in advance…
Jerry
Dim session As NotesSession
Dim db As NotesDatabase ' for personal address book
Dim db2 As NotesDatabase ' for mailfile
Dim nc As NotesNoteCollection
Dim doc As NotesDocument
Dim iCount As Integer
Dim sNoteID As String
Const ITEM_BUILD_NAME = "$TemplateBuild"
Const ITEM_BUILD_DATE = "$TemplateBuildDate"
'get name and address book data
Set session = New NotesSession
Set db = session.GetDatabase("", "names")
Set db2 =session.CurrentDatabase
Set nc = db.CreateNoteCollection(False)
'get mailfile data
'If you are using client version 5.x exit
version1= Cstr(session.NotesVersion)
version2 =Strright(version1, " ")
version =Strleft(version2 , "|")
'Msgbox "Your current notes version is " & version
If Left(version ,1) ="5" Then
Exit Sub
End If
'compare the template version of the names.nsf to target version
If Not nc Is Nothing Then
nc.SelectSharedFields = True
Call nc.BuildCollection
sNoteID = nc.GetFirstNoteId
For iCount = 1 To nc.Count
Set doc = db.GetDocumentByID(sNoteID)
If Not doc Is Nothing Then
If doc.HasItem(ITEM_BUILD_NAME) Then
stemp1 =Cstr(doc.GetItemValue(ITEM_BUILD_NAME)(0)) 'Get a string of the version number so you can compare it
' Print "nab version" & stemp1
stemp =Left(stemp1 , 3)
' Print "nab version first 3 compare" & stemp
same =Strcompare (stemp , "6.5" ,5 ) ' Compare the current to the target
' Print "compare result " & same
If same=0 Then 'If you have the same version as the target do not do anything
Print "Address book and Client are equal"
Exit Sub
End If
'If you do not have the target version then prompt the user
Print "Your Current Address Book Template Version is: " & doc.GetItemValue(ITEM_BUILD_NAME)(0)
Print "Replacing the design of your personal address book to Version 6"
'Msgbox "If a black DOS screen appears prompting you for your Lotus Notes password, enter the password and click OK"
'This is where you put the executable to the nconvert.exe file
Dim result As Integer
'result = Shell("C:\Program Files\lotus\notes\nconvert.exe names.nsf * pernames.ntf", 1)
result = Shell("nconvert.exe names.nsf * pernames.ntf", 6)
If result <>33 Then ' Check to see if it ran OK
Msgbox "Your Personal Name and Address book is not using the correct template. Please contact the help desk at 724-539-5226 to perform a replace design on your personal address book"
Else
Print "Your Personal Address book has been updated, Thank You"
End If
'Msgbox "Date: " & doc.GetItemValue(ITEM_BUILD_DATE)(0) can use this to check the date
Exit For
End If
End If
sNoteID = nc.GetNextNoteID(sNoteID)
Next iCount
End If
End Sub