2015-05-28 160 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

謝謝!現在工作正常。 –