0

Wondering if anyone else has an issue with the "@pnp/sp/lists" getChanges method. The following will not return any changes in my Node Azure Function:

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);

The following PowerShell does return changes

$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

1 Answers1

1

Figured out that I was missing the Item property. The correct IChangeQuery parameter should be:

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

which includes Item: true