2011-01-19 74 views
1

我寫了以下代碼o獲取響應文檔的父級UNID。但我得到「無效的通用ID」錯誤。但是,當我使用「$ Ref」創建文檔鏈接時,我可以使用doclink訪問父文檔。我想訪問父文檔並更改父文檔中的某個字段。任何人都可以提出建議獲取Lotus筆記的父級UNID時出現「無效的通用ID」錯誤

Dim session As New NotesSession 
Dim db As NotesDatabase 
Dim uiwork As New NotesUIWorkspace 
Dim uidoc As NotesUIDocument 

Dim doc As NotesDocument 
Dim parent As Notesdocument  

Set db = session.CurrentDatabase 
Set uidoc=uiwork.currentdocument 
Set doc = uidoc.Document 

'Set parent = db.GetDocumentByUNID(doc.ParentDocumentUNID) 
Set parent = db.GetDocumentByUNID("doc.$Ref") 
'both methods are giving same error 

回答

3

doc.isresponse返回什麼?

使用父母單身應該沒問題。

然而

==>設置父= db.GetDocumentByUNID( 「DOC $參考」)是無效的,應該是:

if doc.hasItem("$Ref") then 
    Set parent = db.GetDocumentByUNID(doc.~$Ref(0)) 
end if 

if doc.hasItem("$Ref") then 
    Set parent = db.GetDocumentByUNID(doc.getItemValue("$Ref")(0)) 
end if 
0

感謝蒂姆。我在QuerySave中編寫了代碼,並且它工作正常。這是給無效的UNID,因爲我正在保存文檔之前嘗試獲取它。

相關問題