Thanks for your reponse. I did just like you said and my agent is running now. But it is giving an error as “Error creating product object”.
The code is below if you have a time please check it where I am wrong.
Sub Initialize
Dim ws As New notesuiworkspace
Dim uidoc As notesuidocument
Dim doc As notesdocument
Dim view, view1,view2 As notesview
Dim db As notesdatabase
Dim ss As New notessession
Dim rtitem As NotesRichTextItem
Set db=ss.currentdatabase
Set view=db.getview("konfkalite")
Set doc=view.getfirstdocument()
While Not doc Is Nothing
If Cstr(doc.tarih(0))=Cstr(Today) Then
Set rtitem = New NotesRichTextItem( SendDoc, "Body" )
'Set Senddoc = view.GetFirstDocument
Call rtitem.AppendDocLink ( doc, doc.Subject( 0 ) & " in " & view.Name )
doc.Subject = "İstediğiniz döküman"
doc.SendTo = "Ozcan Arslan"
doc.Body="Bugün girilen bir kayıt"
Call rtitem.AddNewLine( 1 )
Call doc.Send( False )
Else
doc.Subject = "İstediğiniz döküman yok"
doc.SendTo = "Ozcan Arslan"
doc.Body="Bugün girilmiş bir kayıt bulunmamaktadır"
Call rtitem.AddNewLine( 1 )
Call doc.Send( False )
End If
Set doc=view.getnextdocument(doc)
Wend
Subject: I see at least 5 things wrong with your code.
First if this is a background agent the NotesUIDocument is not a valid declaration.Second your line Dim view, view1, view2 as NotesView does not make view a NotesView, only a Variant. You must declare it as Dim view As NotesView, view1 As NotesView, view2 As NotesView.
Next inside your loop
While Not doc Is Nothing
If Cstr(doc.tarih(0))=Cstr(Today) Then
Set rtitem = New NotesRichTextItem( SendDoc, "Body" ) 'SendDoc is not declared or created
'Set Senddoc = view.GetFirstDocument
Call rtitem.AppendDocLink ( doc, doc.Subject( 0 ) & " in " & view.Name )
doc.Subject = "İstediğiniz döküman"
doc.SendTo = "Ozcan Arslan"
doc.Body="Bugün girilen bir kayıt" ' Now you are overwriting any thing in your RTItem by creating a text item named Body on the doc
Call rtitem.AddNewLine( 1 ) 'does not exist see above
Call doc.Send( False )
Else
doc.Subject = "İstediğiniz döküman yok"
doc.SendTo = "Ozcan Arslan"
doc.Body="Bugün girilmiş bir kayıt bulunmamaktadır"
Call rtitem.AddNewLine( 1 ) ' rtitem is not created in this part of the If statement
Call doc.Send( False )
End If
Set doc=view.getnextdocument(doc)
That error message doesn’t make sense to me, but you might want to code with “Option Declare” set, and use the debugger – for example, I can’t see “senddoc” declared or set anywhere.