Skip to content

Commit

Permalink
updating lists docs getChanges example to use new util method
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-rodgers committed Feb 4, 2025
1 parent 1915f7f commit 0af9f95
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions docs/sp/lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,20 +237,18 @@ console.log(r);
To get changes from a specific time range you can use the ChangeTokenStart or a combination of ChangeTokenStart and ChangeTokenEnd.

```TypeScript
import { IChangeQuery } from "@pnp/sp";
import { IChangeQuery, createChangeToken } from "@pnp/sp";

//Resource is the list Id (as Guid)
const resource = list.Id;
const changeStart = new Date("2022-02-22").getTime();
const changeTokenStart = `1;3;${resource};${changeStart};-1`;
const changeTokenStart = createChangeToken("list", list.Id, new Date("2022-02-22"));

// build the changeQuery object, here we look at changes regarding Add and Update for Items.
const changeQuery: IChangeQuery = {
Add: true,
Update: true,
Item: true,
ChangeTokenEnd: null,
ChangeTokenStart: { StringValue: changeTokenStart },
ChangeTokenStart: changeTokenStart,
};

// get list changes
Expand Down

0 comments on commit 0af9f95

Please sign in to comment.