Lotus notes LotusScript代理不工作

Lotus notes LotusScript代理不工作,lotus-notes,agent,lotusscript,Lotus Notes,Agent,Lotusscript,我与该代理有问题-我在一个类似的代理中使用了完全相同的技术,但出于某种原因,客户报告此行有错误: Set dc = locView.GetAllDocumentsByKey(key, True) 表示未设置对象变量。你能帮我找到我缺少的东西吗 提前谢谢 %REM Sub as_archiveOldDocuments Description: This agent archives documents that are more than one week old. This is so tha

我与该代理有问题-我在一个类似的代理中使用了完全相同的技术,但出于某种原因,客户报告此行有错误:

Set dc = locView.GetAllDocumentsByKey(key, True)
表示未设置对象变量。你能帮我找到我缺少的东西吗

提前谢谢

%REM
Sub as_archiveOldDocuments
Description:
This agent archives documents that are more than one week old.
This is so that the dataset used is kept current - view selections only select documents
whose archived field value is equal to zero. For that reason, this agent detects whether
or not a document in the set is more than a week old. If it is, the Archived field is
marked as '1'.

Function calls: N/A
Sub calls: N/A
Called in event: N/A
Called by: ag_archiveOldDocuments

%END REM
Public Sub as_archiveOldDocuments

Dim s As NotesSession
Dim locDb As New NotesDatabase(****)
Dim locView As NotesView
Set locView = locDb.GetView("byNameDateLocCode")
Dim dc As NotesDocumentCollection
'Set dc = locDb.CreateDocumentCollection()
Dim key (0 To 1) As Variant
Dim archiveDate As NotesDateTime
Set archiveDate = New NotesDateTime(Today)
Call archiveDate.AdjustDay(-7)
Dim thisDoc As NotesDocument
Dim unarchived As Integer
Let unarchived = "0" 

'populate key to build document collection, then build it
key(0) = archiveDate.DateOnly
key(1) = unarchived
Set dc = locView.GetAllDocumentsByKey(key, True)

'find first document in the collection
Set thisDoc = dc.GetFirstDocument()

'while the doc collection exists
While Not dc Is Nothing

    'if the date value in the document is less than the archiveDate value specified (today -7)
    If thisDoc.Date <= archiveDate.DateOnly Then

        'replace the archived value (which will be '0') with '1'
        Call thisDoc.ReplaceItemValue("Archived", "1")
        Call thisDoc.ComputeWithForm(False,True)
        Call thisDoc.Save(True, False, False)

    End If

    Set thisDoc = dc.GetNextDocument(thisDoc)

Wend
%REM
Sub as_归档文件
说明:
此代理将存档超过一周的文档。
这样,使用的数据集将保持为当前-视图选择仅选择文档
其存档字段值等于零。因此,此代理将检测
集合中的文档是否超过一周。如果是,则存档字段为
标记为“1”。
函数调用:不适用
子呼叫:不适用
在事件中调用:不适用
调用人:ag_archiveOldDocuments
%终止REM
公共子文档作为归档文档
将s变暗为注释会话
Dim locDb作为新注释数据库(****)
将本地视图变暗为注释视图
设置locView=locDb.GetView(“byNameDateLocCode”)
将dc设置为备注文档集合
'Set dc=locDb.CreateDocumentCollection()
变暗键(0到1)作为变型
Dim archiveDate作为NotesDateTime
设置archiveDate=New NotesDateTime(今天)
致电存档日期。调整日期(-7)
将此文档设置为备注文档
Dim未归档为整数
让未归档=“0”
'填充键以生成文档集合,然后生成它
键(0)=archiveDate.DateOnly
键(1)=未归档
设置dc=locView.GetAllDocumentsByKey(键,True)
'查找集合中的第一个文档
设置thisDoc=dc.GetFirstDocument()
'而文档集合存在
而不是dc什么都不是
'如果文档中的日期值小于指定的存档日期值(今天-7)

如果此文档日期很可能该行失败:

Set locView = locDb.GetView("byNameDateLocCode")

您在调试器中看到了locView的哪些内容?如果它不是有效的视图,请检查视图名称以确保它与上述内容匹配,并检查数据库ACL和视图上的任何限制以确保您具有所需的权限。如果代理作为web代理运行,请确保签名者和/或服务器具有所需的权限(取决于您对代理运行时标识的设置)。如果数据库locDb位于与代理运行所在服务器不同的服务器上,请确保目标服务器已向代理服务器授予“受信任服务器”权限。

此行最有可能出现故障:

Set locView = locDb.GetView("byNameDateLocCode")
您在调试器中看到了locView的哪些内容?如果它不是有效的视图,请检查视图名称以确保它与上述内容匹配,并检查数据库ACL和视图上的任何限制以确保您具有所需的权限。如果代理作为web代理运行,请确保签名者和/或服务器具有所需的权限(取决于您对代理运行时标识的设置)。如果数据库locDb位于与代理运行所在服务器不同的服务器上,请确保目标服务器已向代理服务器授予“受信任服务器”权限