I am currently using the compare()
function to compare two files, and when the changes appear on the Word side, I want to use getTrackedChanges()
to retrieve those changes. However, when I log it using console.log, the items array is empty.
I want to use compare to compare file 1 and file 2. When I set file 1 as the current file, I can retrieve the changes in the items, but when I set file 2 as the current file, I am unable to do so.
const compareFiles = async () => {
const createdBy = “name”
try {
await Word.run(async (context) => {
const options = {
authorName: createdBy,
};
context.document.compare(“https:demo.blob.test”, options);
await context.sync();
});
} catch (error) {
console.log("error: ", error);
}
};
const getTrackedChanges = async () => {
await Word.run(async (context) => {
const body = context.document.body;
const trackedChanges = body.getTrackedChanges();
trackedChanges.load("items");
await context.sync();
}
};
Does anyone have a solution that could help me?