How to show differences between versions on an SPO list item?

Copper Contributor

This is more of a Javascript coding issue rather than anything SharePoint specific.

I'm using the below:

const deepDiff = (obj1: any, obj2: any): any => {
    let difference = {

    };
    // Implementation
    return difference;
}

export const GetVersionsForItem = async (listName: string, itemId: any) => {

    const list = sp.web.lists.getByTitle(listName);
    list.items.getById(itemId).versions()
        .then(versions => {
            console.log(versions, 'versions');
            return versions.map((current, i) => {
                return i === 0 ? current : deepDiff(current, versions[i - 1])
            });
        })
        .then(changes => console.log(changes, 'changes'));
};

This gets all the versions of the SharePoint list item. 

 

I want to show the fields that are different. How would I do this, in the deepDiff function?

0 Replies