Version History Check in Comment

Hi,

Referring to this article:

https://plumsail.com/docs/forms-sp/examples/version-history.html

I am working with a document library, with version control turned on.
In my form I would also like to display the check in comment. It would follow after Comments: in the image below.

I tried the code below as a stab in the dark. I'm not sure exactly what gets returned by this call. I've guessed _CheckinComment. I would greatly appreciate being pointed in the right direction?

Vue.component('version-history', {
    template: '<div><p v-for="(entry, i) in entries">v{{entry.version}} was created at {{entry.date}} by {{entry.user}}. Comments: {{entry.comment}} </p></div>',
    data: function() {
        return {
            entries: []
        }
    },
    mounted: function() {
        var self = this;
        var listUrl = fd.webUrl + fd.listUrl;
        var id = fd.itemId;
        pnp.sp.web.getList(listUrl)
            .items
            .getById(id)
            .versions
            .get()
            .then(function(versions){
                self.entries = versions.map(function(v) {
                    return {
                        version: v.VersionLabel,
                        date: new Date(v.Modified).toLocaleString(),
                        user: v.Editor.LookupValue,
                        comment: v._CheckinComment
                    }
                })
            });
    }
});

Thanks, Adam

Love your work!

Hello @AdamSmith,

Using PnPjs library you can get only the last check in comment like this:

                self.entries = versions.map(function(v) {
                    return {
                        version: v.VersionLabel,
                        date: new Date(v.Modified).toLocaleString(),
                        user: v.Editor.LookupValue,
                        comment: v.OData__x005f_CheckinComment
                    }
                })
1 Like

Thank you so much! Working well.

1 Like