1

応答文書の親 UNID を取得する次のコードを作成しました。しかし、「無効なユニバーサル ID」というエラーが表示されます。しかし、「$Ref」を使用して doclink を作成すると、doclink を使用して親ドキュメントにアクセスできます。親ドキュメントにアクセスして、親ドキュメントのフィールドの 1 つを変更したい。誰でも何か提案できますか?

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 は何を返しますか?

親ユニットを使用しても問題ありません。でも

==> 親を設定 = 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 を取得しようとしたため、無効な UNID が返されました。

于 2011-01-21T07:04:52.790 に答える