0

我收到以下错误消息: 在此处输入图像描述

单击我通过单击发送给经理按钮生成的电子邮件中附加的文档链接。我也尝试使用 NotesURL 而不是 doclink:

Call rtitem.appendtext(emaildoc.Notesurl)

但生成的 URL 与 doclink 不同。下面是从 doclink 本身生成的。

Generated NotesURL: notes://LNCDC@PHGDC/__48257E3E00234910.nsf/0/237B2549EEA393A948257E530042BA4A?OpenDocument

Doclink: Notes://LNCDC/48257E3E00234910/28BD6697AB48F55348257E2D0006CF60/C9B0266FDC0D929E48257E530041D6F9

你能帮忙吗?下面是我的代理代码。

%REM
	Agent Send Email to Managers
%END REM
Option Public
Option Declare
Dim s As NotesSession
Dim db As NotesDatabase
Dim emaildoc As NotesDocument
Dim paydoc As NotesDocument
Dim rtitem As NotesRichTextItem
Dim i As Integer
Dim view As NotesView
Sub Initialize
	Set s = New NotesSession
	Set db = s.CurrentDatabase
	Set view = db.GetView("Pending Claims")
	Dim addresses As NotesName
	Dim arrpem As Variant
	ReDim arrpem(0)
	Set paydoc = view.GetFirstDocument

	'// Store all PEM names in an array
	While Not(paydoc Is Nothing)
		ReDim Preserve arrpem(UBound(arrpem) + 1)
		arrpem(UBound(arrpem)) = paydoc.PeopleManager(0)
		Set paydoc = view.GetNextDocument(paydoc)

	Wend
	'// Remove all duplicate PEM names and empty entries in the array
	arrpem = FullTrim(ArrayUnique (arrpem))

	'// Loop the PEM names array
	ForAll pem In arrpem
		Set emaildoc = New NotesDocument(db)
		Set addresses = New NotesName(pem)
		If addresses.abbreviated <> "" Then
			emaildoc.SendTo = addresses.abbreviated
			emaildoc.Subject = "Leave Balances of your Direct Reports"
			emaildoc.Form = "Memo"
			Set rtitem = New NotesRichTextItem(emaildoc, "Body")
			Call rtitem.AppendText("Dear " & addresses.common & ",")
			Call rtitem.AddNewLine(2)

			'// Remove paydoc value which was used in the PEM names array
			Set paydoc = Nothing

			'// Get all documents that has matching PEM name in the view
			Dim dc As NotesDocumentCollection
			Set dc = view.GetAllDocumentsByKey(addresses.Abbreviated, True)
			Set paydoc = dc.GetFirstDocument

			'// Append doc link of employee
			While Not(paydoc Is Nothing)
				Call rtitem.AppendText("Doc link of :" & paydoc.FMName(0) & " " & paydoc.LastName(0))
				Call rtitem.appenddoclink(emaildoc, "Link to Leave Balance of " & paydoc.FMName(0) & " " & paydoc.LastName(0))			
				Call rtitem.AddNewLine(1)
				Set paydoc = dc.GetNextDocument(paydoc)
			Wend

			'// Send email per PEM
			Call emaildoc.Send(False)
		End If
	End ForAll

	MsgBox "Emails successfully sent."

End Sub 

4

1 回答 1

3

doclink 指向您在内存中为电子邮件创建的文档。发送后,该文档不再存在于原始数据库中。

将您的代码更改为:

Call rtitem.appendtext(paydoc.Notesurl)
于 2015-05-28T09:36:26.407 回答