在不起作用的pnp-js Node Azure功能列表上获取更改

问题描述 投票:0回答:1

想知道其他人是否对"@pnp/sp/lists" getChanges方法有疑问。以下内容不会在我的Node Azure函数中返回任何更改:

const changeQuery: IChangeQuery = {
    Add: true,
    ChangeTokenEnd: null,
    ChangeTokenStart: null,
    DeleteObject: true,
    Rename: true,
    Restore: true,
    Update: true
};
const changes = await sp.web.lists.getByTitle("My Library").getChanges(changeQuery);

以下PowerShell确实会返回更改

$list = Get-PnPList -Identity 'Bamert AP Documents'
$cq = new-object Microsoft.Sharepoint.Client.ChangeQuery($true,$true)
$changes=$list.GetChanges($cq)
$list.Context.Load($changes)
$list.Context.ExecuteQuery()
$changes.count
#returns 1000
node.js sharepoint pnp-js
1个回答
0
投票

[发现我缺少Item属性。正确的IChangeQuery参数应为:

const changeQuery: IChangeQuery = {
    Add: true,
    ChangeTokenEnd: null,
    ChangeTokenStart: null,
    DeleteObject: true,
    Rename: true,
    Restore: true,
    Update: true,
    Item:true
};

其中包括Item: true

© www.soinside.com 2019 - 2024. All rights reserved.