1

我已经编写了以下代码来获取响应文档的父 UNID。但我收到“无效的通用 ID”错误。但是当我使用“$Ref”创建一个 doclink 时,我可以使用 doclink 访问父文档。我想访问父文档并更改父文档中的字段之一。任何人都可以提出任何建议吗?

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
4

2 回答 2

3

doc.isresponse 返回什么?

使用父unid应该没问题。然而

==>设置父级= db.GetDocumentByUNID("doc.$Ref")

无效,应该是:

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
于 2011-01-19T17:27:53.343 回答
0

谢谢蒂姆。我在 QuerySave 中编写了代码,它运行良好。它给出了无效的 UNID,因为我试图在保存文档之前获取它。

于 2011-01-21T07:04:52.790 回答