Hi,
I’m trying to go through documents I have in a View called CTCDone and send out and e-mail to persons who have had their mail converted from our old POP3 server to Notes and along the way notify key personnel who need to know such a conversion has taken place. If the document is in this view and the field EmailNotificationOfCompletion = N then the document should be processed.
However, as I walk through the code with the Script Debugger I get a “Type Mismatch” Error. I have put an arrow by the line where the code bombs out. Can someone take a look and maybe give me some recommendations?
Sub Initialize
Dim s As New notessession
Dim db As notesdatabase
Dim doc As notesdocument
Dim maildoc As notesdocument
Dim rtitem As notesrichtextitem
Dim copytoPeople(0 To 1) As String
Dim view As NotesView
servername = s.UserName
Set db = s.CurrentDatabase
'Set doc = s.DocumentContext
Set view = db.getview("CTCDone")
Set doc = view.getfirstdocument
Do While Not doc Is Nothing
If doc.EmailNotificationOfCompletion = N Then (<-- Type mistach occurs here)
doc.Status = "Done"
Set maildoc = db.CreateDocument
copytoPeople(0) = "person@mail.edu"
copytoPeople(1) = "person@mail.edu"
maildoc.form = "Memo"
'maildoc.SendTo = doc.Email(0)
maildoc.SendTo = "person@mail.edu"
maildoc.CopyTo = copytoPeople
maildoc.subject = "Migration from Mail1 to Notes mail complete"
Set rtitem = New NotesRichTextItem(maildoc,"Body")
Call rtitem.appendtext("If you are an iNotes user then you migration is complete. If you have a GUI Notes client then follow the below")
Call rtitem.addnewline(1)
Call rtitem.appendtext("Your Mail1/Mail2 email has been migrated to MCVH. To finish migrating your address book, please follow the instructions below:")
Call rtitem.addnewline(2)
Call rtitem.AppendText("1. Open your Mail")
Call rtitem.addnewline(1)
Call rtitem.AppendText("2. Select Actions - Synchronize Address Book from the actions menu at the top of the screen.")
Call rtitem.appendtext("Your Mail1/Mail2 email has been migrated to M.")
Call rtitem.AddNewline(2)
Call rtitem.AppendText("A request has been submitted to remove your Mail1/Mail2 email account.")
Call rtitem.AddNewline(2)
Call rtitem.AppendText("Your M email address(" + "person@mail.edu" + ") will be redirected to " + "person@mail.edu" + ".")
Call rtitem.AddNewline(2)
Call rtitem.AppendText("Lotus Support Team")
Call rtitem.addnewline(1)
Call rtitem.AppendText("Contact the Help Desk with questions at 555-1212")
Call maildoc.Send(False)
End If
doc.EmailNotificationOfCompletion = Y
Set doc = view.getnextdocument(doc)
Loop
Exit Sub
End Sub