解答 |
千万注意:下面是一段样例程序,只是提供了一个实现方法。Notes 技术支持部门不会根据某个用户的环境去定制这段代码。对用户来说这只是一个建议,并不属于 IBM Lotus 软件的支持范围内。
在数据库中创建一个新的代理,代理属性为: 共享 触发:按事件,新邮件到达后 包含以下代码: Sub Initialize On Error Goto ErrorHandler Dim s As New NotesSession Dim a As NotesAgent Dim col As NotesDocumentCollection Dim doc As NotesDocument, rptDoc As NotesDocument Dim stDate As NotesItem
Set a = s.CurrentAgent Set col = s.CurrentDatabase.UnprocessedDocuments()
Set doc = col.getfirstdocument Do Until doc Is Nothing If doc.Repeats(0) = "1" Then 'Save the main doc doc.NoticeType = "A" doc.Form = "Appointment" doc.ReplaceItemValue "$CSFlags", "c" doc.ReplaceItemValue "Subject", doc.GetItemValue("TOPIC") doc.ReplaceItemValue "_ViewIcon", 158 doc.Save True, False doc.RemoveFromFolder "($Inbox)" 'Create child document Set rptDoc = s.CurrentDatabase.CreateDocument() rptDoc.MakeResponse doc doc.CopyAllItems rptDoc rptDoc.ReplaceItemValue "StartDate", rptDoc.GetItemValue("StartDateTime") rptDoc.ReplaceItemValue "StartTime", rptDoc.GetItemValue("StartDateTime") Set stDate = rptDoc.GetFirstItem("RepeatDates") rptDoc.CopyItem stDate, "RepeatInstanceDates" rptDoc.CopyItem stDate, "StartDateTime" rptDoc.CopyItem stDate, "CALENDARDATETIME" rptDoc.ReplaceItemValue "EndDate", rptDoc.GetItemValue("EndDateTime") rptDoc.ReplaceItemValue "EndTime", rptDoc.GetItemValue("EndDateTime") Set stDate = rptDoc.GetFirstItem("RepeatEndDates") rptDoc.CopyItem stDate, "EndDateTime" rptDoc.ReplaceItemValue "OrgRepeat", "1" rptDoc.ReplaceItemValue "ORGTABLE", "C0" rptDoc.ReplaceItemValue "Repeats", "1" rptDoc.ReplaceItemValue "$RefOptions", "1" rptDoc.ReplaceItemValue "$CSFlags", "i" rptDoc.Form = "Appointment" rptDoc.Save True, False Else Set rptDoc = s.CurrentDatabase.CreateDocument() rptDoc.MakeResponse doc doc.CopyAllItems rptDoc doc.NoticeType = "A" Set stDate = rptDoc.GetFirstItem("StartDateTime") rptDoc.CopyItem stDate, "CALENDARDATETIME" rptDoc.Save True, False doc.Save True, False doc.RemoveFromFolder "($Inbox)" End If Call s.UpdateProcessedDoc(doc) Set doc = col.GetNextDocument(doc) Loop Done: Exit Sub
ErrorHandler: Print "Error in agent AutoAccept in " & a.Parent.FilePath Print "Error (" & Cstr(Err) & " on line " & Cstr(Erl) & "): " & Error Resume Done End Sub
|