Sub Initialize
On Error GoTo errormsg
Dim curdb As NotesDatabase
Dim Up_number As String,mobile As String,content As string
Dim notedoc As NotesDocument
Dim session As New NotesSession
Dim Agent As NotesAgent
Set agent = session.CurrentAgent
Set curdb=session.Currentdatabase
MsgBox "222222222"
Set notedoc = curdb.GetDocumentByID(agent.ParameterDocID)
MsgBox "333333333333"
Set Sms=New Meipwebserviceserverporttype_n4
'sid=Sms.Login("nfjdejmh", "nfjdejmhgmcc")
Up_number=notedoc.Up_number(0)
mobile=notedoc.mobile(0)
content=notedoc.content(0)
Call notedoc.Remove(true)
Call SmsApproval(Up_number,mobile,content) 'content Y+同意,N+不同意
Exit sub
errormsg:
MsgBox "SmsApprovalJava Error:" & Str(Erl) & " " & Error
End Sub
为什么我执行到Set notedoc = curdb.GetDocumentByID(agent.ParameterDocID)时,执行不下去而报有“Invalid Note id”这个错呢
这个代理必须使用这样的代码被调用:
Dim Agent As NotesAgent
Set curdb=session.Currentdatabase
set Agent = curdb.GetAgent("这个代理")
Call Agent.RunOnServer(doc.NoteID)
'doc是你要传给代理处理的那个文档的Note ID, 这样那个agent.ParameterDocID参数才有效。
查看了一下帮助文档,确实如所说的那样,
If agent.RunOnServer(doc.NoteID) = 0 Then
Messagebox "Agent ran",, "Success"
Else
Messagebox "Agent did not run",, "Failure"
需要带一个参数条件才可以执行的。