2011-01-19 27 views
1

以下のコードを記述しました。応答ドキュメントの親UNIDを取得しました。しかし、「無効なユニバーサルID」エラーが発生しています。しかし、 "$ Ref"を使ってdoclinkを作成すると、doclinkを使って親のdocにアクセスすることができます。私は親文書にアクセスし、親文書のフィールドの1つを変更したいと思います。誰でも何かを提案できますか?ロータスノートの親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は何を返しますか?

親のunidを使用すると問題はありません。しかし

==>を設定し、親= 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を与えていました。

関連する問題