2015-05-28 123 views
0

我收到以下错误消息“链接的文档(UNID ......不能在视图(UNID ...)发现” 。附着在被我通过点击发送到管理者按钮生成的电子邮件我还用NotesURL代替文档链接尝试:
获取错误消息

Call rtitem.appendtext(emaildoc.Notesurl) 

但是生成的网址与文档链接不同的下面是生成的。从doclink本身。

生成NotesURL:笔记://[email protected]/__48257E3E00234910.nsf/0/237B2549EEA393A948257E530042BA4A OpenDocument格式

文档链接:注意:// LNCDC/48257E3E00234910/28BD6697AB48F55348257E2D0006CF60/C9B0266FDC0D929E48257E530041D6F9

能否请您帮帮我?以下是我的代理代码。

%REM 
 
\t 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 
 
\t Set s = New NotesSession 
 
\t Set db = s.CurrentDatabase 
 
\t Set view = db.GetView("Pending Claims") 
 
\t Dim addresses As NotesName 
 
\t Dim arrpem As Variant 
 
\t ReDim arrpem(0) 
 
\t Set paydoc = view.GetFirstDocument 
 

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

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

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

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

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

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

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

 
\t MsgBox "Emails successfully sent." 
 

 
End Sub

+2

你追加电子邮件的文档链接?这是正确的吗?哟不应该附加paydoc文档的文档链接? – OliC

+0

你知道吗,你是一个救世主。谢谢!现在它工作正常。 :) –

回答

3

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

更改您的代码为:

Call rtitem.appendtext(paydoc.Notesurl) 
+0

谢谢!现在工作正常。 –