Subject: Got Error 13 Type mismatch in line: 47
Hi Axel,
This give an error : Got Error 13 Type mismatch in line: 47
Dim homeserver As New NotesName ( doc1.GetItemValue(“mailserver”))
The Whole code is below…You will see ‘***Error’ on right as scrolling Half way down.
Sub Initialize
On Error Goto errhandler
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim doc1 As NotesDocument
Dim doc2 As NotesDocument
Dim agent As NotesAgent
Dim item As NotesItem
Dim nab As NotesDatabase
Dim view As NotesView
Dim mailfile As Variant
Dim destdb As notesdatabase
Set agent = session.CurrentAgent
Set db = session.CurrentDatabase
'Get document used for passing data
Print "Oil Secretaries Calendar Agent Running Activated"
Print "Attempting to Locate Calendar Entry being Saved..."
Set doc = db.GetDocumentByID(agent.ParameterDocID)
If doc.HasItem("Form") Then
Print "Calendar Entry Found"
Else
Print "Calendar Entry NOT found"
End If
'Run Loop through any names in AlarmDialog Field
Forall n In doc.AlarmDialog
'Get current NAB
Set nab = session.GetDatabase("" , "names.nsf")
'Get view in NAB
Set view = nab.GetView("($Users)")
'Find person document in view
Print "Attempting to Locate Person Document in NAB..."
Set doc1 = view.GetDocumentByKey( n, True)
If doc1.HasItem("mailserver") Then
Print "Person Document Found"
Else
Print "Person Document NOT found"
End If
'Find MailServer field values from Person document
Print "Extracting MailServer from Person Document"
Dim homeserver As New NotesName ( doc1.GetItemValue("mailserver")) ***Error***
servername = homeserver.abbreviated
Print "ServerName" & servername
'Find Mailfile field values from Person document
Print "Extracting Mailfile path from Person Document"
mailfile = doc1.GetItemValue("mailfile")
Print "Persons Mailfile Path is " & mailfile(0)
'Get database to create document in
Set destdb = session.GetDatabase( servername , mailfile(0))
Set doc = db.GetDocumentByID(agent.ParameterDocID)
'Create mini-doc
Set doc2 = New NotesDocument(destdb)
Set item = doc.GetFirstItem("$Alarm")
Call item.CopyItemToDocument(doc2, "$Alarm")
Set item = doc.GetFirstItem("$AlarmOffset")
Call item.CopyItemToDocument(doc2, "$AlarmOffset")
If doc.HasItem("RepeatDates") Then
Set item = doc.GetFirstItem("RepeatDates")
Else
Set item = doc.GetFirstItem("CalendarDateTime")
End If
Call item.CopyItemToDocument(doc2, "CalendarDateTime")
Call item.CopyItemToDocument(doc2, "PostedDate")
Set item = doc.GetFirstItem("Subject")
Call item.CopyItemToDocument(doc2, "Subject")
'Save and move mini-doc to folder
Call doc2.Save(True , False , True)
Call doc2.PutInFolder ("($Alarms)")
End Forall
ErrHandler:
Print "Got Error " & Cstr( Err() ) & " " & Error() & " in line: " & Cstr( Erl() )
Resume Next
End Sub