【发布时间】:2014-01-05 01:04:24
【问题描述】:
我遇到的问题是用户 ID 文件无法访问某些消息,我想跳过这些文件而不是代理崩溃。收到的错误信息如下:
如果发生这种情况,使用查看方法我可以暂时删除文档并重新运行代理,但如果有一种方法可以跳过文档,那将是一个很大的帮助。
感谢各位的帮助。
好的,我已将代码修改到我几乎可以接受的程度。
子初始化
Dim s As New notessession
Dim db As notesdatabase
Dim view As notesview
Dim doc As notesdocument
Dim nextdoc As notesdocument
Set db = s.currentdatabase
If view Is Nothing Then
Set view = db.CreateView("Encrypted",{Encrypt="1"})
End If
Set doc = view.getfirstdocument
On Error Goto ErrorHandler
While Not doc Is Nothing
nextDocument:
Set nextdoc = view.getnextdocument(doc)
'The below loop is mandatory to ensure that all $File entries are unecrypted
Forall i In doc.items
If i.isencrypted Then
i.isencrypted=False
End If
End Forall
'Must have at least 1 field encrypted in order to call Encrypt method
Dim temp As New NotesItem(doc,"tempjunk","temp")
temp.IsEncrypted=True
Call doc.encrypt
Call doc.save(True, False)
'This portion can now remove the fields relative to encrypting the
'single token encrypted field.
Call doc.removeitem("$Seal")
Call doc.removeitem("$SealData")
Call doc.removeitem("SecretEncryptionKeys")
Call doc.removeitem("Encrypt")
Call doc.removeItem("tempjunk")
Call doc.save(True, False)
Set doc = nextdoc
Wend
Exit Sub
ErrorHandler:
On Error Resume nextDocument
Exit Sub
结束子
错误处理不太好;
On Error Resume nextDocument 显示为错误。 我已经尝试抑制所有似乎试图剥离加密的错误警告,但我认为它们的消息正文因此被破坏。
【问题讨论】:
-
我猜 Karl-Henry 的例子并不理想。它应该说“on error goto errhandler”并且在 err handler 块中“resume nextdocument”(而不是“on error resume nextdocument”)
-
你是对的,我在下面更新了我的代码。
标签: view lotus-notes lotus-domino lotusscript agent