Hello everyone. Here’s what I’ve got going on. We’re moving all users local archives to an archive server. We’ve moved the files and I’m writing 2 buttons to add the bookmarks to the user’s archives on the archive server. The first button gets the replica ids of the archives and records it in a temporary database. The second button gets the replica ids from the temporary database and creates bookmarks to the archives on the archive server. The problem I’m having is the bookmarks that get created are to the local replicas and not the replicas on the archive server. There are no errors returned unless the archive isn’t on the archive server.
Here is the code for the 2 buttons.
Button 1:
Sub Click(Source As Button)
On Error Goto errLbl
Dim s As New NotesSession
Dim archDB As NotesDatabase
Dim trackDB As New NotesDatabase("4pad-pbs-04-1","working\archivetracking.nsf")
Dim repDB As New NotesDatabase("4pad-pbs-04-1","working\archfile.nsf")
Dim trackView As NotesView
Dim repDoc As NotesDocument
Dim bookDoc As NotesDocument
Dim repIDIt As NotesItem
Dim repIDTitleIt As NotesItem
Dim group As String, group1 As String, group2 As String, group3 As String, group4 As String
Dim useName As NotesName
Dim letter As String
Dim dbDir As NotesDbDirectory
Dim i As Integer
'Figure out the first letter of the users first name
Set useName = New NotesName(s.UserName)
letter = Left(useName.Common,1)
group1 = "abcd"
group2 = "efghij"
group3 = "klmn"
group4 = "opqrstuvwxyz"
If Instr(1,group1,letter,5) > 0 Then
group = "group1"
Elseif Instr(1,group2,letter,5) > 0 Then
group = "group2"
Elseif Instr(1,group3,letter,5) > 0 Then
group = "group3"
Elseif Instr(1,group4,letter,5) > 0 Then
group = "group4"
End If
'Loop through all the databases on the server and only record the ones where the user name is in the path
Set dbDir = New NotesDbDirectory("4pad-pbs-04-4")
Set archDB = dbDir.GetFirstDatabase(1247)
i = 0
While Not archDB Is Nothing
Print archDB.Server + " - " + archDB.FilePath
If Instr(archDB.FilePath,useName.Common) > 0 Then
'Add replica IDs of the archives to the Temp database for retrieval by the 2nd button
If i = 0 Then
Set repDoc = New NotesDocument(repDB)
End If
repDoc.UserName = s.UserName
If i = 0 Then
Set repIDit = repDoc.AppendItemValue("ArchRepID",archDB.ReplicaID)
Set repIDTitleIt = repDoc.AppendItemValue("ArchRepTitle",archDB.Title)
Elseif i > 0 Then
Call repIDit.AppendToTextList(archDB.ReplicaID)
Call repIDTitleIt.AppendToTextList(archDB.Title)
End If
Call repDoc.Save(True,True)
i = i + 1
End If
Set archDB = dbDir.GetNextDatabase
Wend
'Record that the user clicked on the button
Set trackDoc = trackDB.CreateDocument
trackDoc.Form = "Status"
trackDoc.uName = s.UserName
trackDoc.uDate = Now
Call trackDoc.Save(True,True)
Set trackView = trackDB.GetView("lookup")
Set trackDoc = trackView.GetDocumentByKey(s.UserName)
If Not trackDoc Is Nothing Then
trackDoc.luCompleted = "Yes"
Call trackDoc.Save(True,True)
End If
'Notify user to click the "Click Me 2nd" button
Msgbox |Found | + Cstr(i) + | archive(s). Please click the button that says "Click Me 2nd"|,0,"More Left to do..."
Exit Sub
errLbl:
If Err = 4412 Then
Msgbox "Your archives haven't been copied yet. Please notify the helpdesk",0,"Error - Archives not present"
Elseif Err = 4063 Then
Msgbox "Your archives haven't been copied yet. Please notify the helpdesk",0,"Error - Archives not present"
Else
Msgbox "An error has occurred. The error was " & Error$ & ". Error Number - " & Err & Chr(13) & "Please take a screenshot of this error and provide it to the Helpdesk", 0, "Error"
End If
Exit Sub
End Sub
Button 2:
replicaIDs := @DbLookup(“”:“”;“4pad-pbs-04-1”:“working\archfile.nsf”;“UserName”;@UserName;“ArchRepID”);
replicaTitles := @DbLookup(“”:“”;“4pad-pbs-04-1”:“working\archfile.nsf”;“UserName”;@UserName;“ArchRepTitle”);
@If(@IsError(replicaIDs);@Prompt([Ok];“Error”;"WARNING!! Please ensure you clicked the "Click Me 1st" button. " + @NewLine + “If you did click the "Click Me 1st" button then please contact the helpdesk.”);
@Do(
@For(n := 1;
n <= @Elements(replicaIDs);
n := n + 1;
@Command([AddBookmark];"notes://4pad-pbs-04-4/" + replicaIDs[n];replicaTitles[n];"Old Archives")
);
@Prompt([Ok];"Completed";"You should now have a new folder in your Bookmark Column on the far left of your screen called Old Archives")
)
)
Any help you could provide would be great.
Keith