获取"链接的文档(UNID ...在视图中找不到(UNID ...)"错误消息

时间:2015-05-28 04:35:59

标签: lotus-notes lotusscript notesview

我收到以下错误消息: enter image description here

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

Call rtitem.appendtext(emaildoc.Notesurl)

但生成的网址与doclink不同。以下是从doclink本身生成的。

生成的NotesURL:说明://LNCDC@PHGDC/__48257E3E00234910.nsf/0/237B2549EEA393A948257E530042BA4A?OpenDocument

Doclink:备注:// 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 
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:3)

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

将您的代码更改为:

Call rtitem.appendtext(paydoc.Notesurl)