0

想知道其他人是否对“@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
4

1 回答 1

1

发现我错过了 Item 属性。正确的 IChangeQuery 参数应该是:

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

包括Item: true

于 2020-03-18T00:15:40.837 回答