Skip to main content

Is there a way to get the version history of a list item column in SharePoint 365?  

 

This post explains how to do it with workflows for SharePoint On Prem:

Solved: Re: Extracting Data from Appended Multi-Line Text ... - Nintex Community.

 

I don't see an action named "Call Web Service" in 365.  The closest action I see is "Web Request," but the parameters are completely different.  If it's even possible, I don't know how to translate the options.

Hi  @ab50439 



 



Use SharePoint REST API



<Your SPO site>/_api/web/Lists/getbytitle('<Your_Listname>')/items(<Item ID>)/versions?$select=<Column 1>,VersionLabel


Just add your SPO site, List name, ID and the column which your want



 



Just open a new IE browser and enter the URL.



https://nintex.sharepoint.com/sites/development01/_api/web/Lists/getbytitle('Listname')/items(100)/versions?$select=Title,VersionLabel


The result is return as XML. 



 



Cheers


Okay, but how do I do that in a workflow, since I need to loop through 15k list items?

Hi @ab50439 



 



Can you elaborate on what it is that you really want to accomplish?



 



This is my interpretation based on your inputs



1. You want to loop thru a list which has 15k item. 



2. You want to get the version history of a specify column - let's just call this column "Status" which stores the current state of the workflow. Below is the possible values.





3. Let's say that below is a partial part of your list.





4. Is this what you want to accomplish? List all the versions of Status for an item.





Repeat for the other 14,998+ items



 



I have another 3 questions for you.



a) Is this a one-time thingy or will you run it on a scheduled (daily, weekly, monthly)



b) Where or How are you going to save/store the results?



c) Are you able to use SharePoint REST API in your browser?


Hi Garret,



I'm working on a workaround for the missing Nintex Forms feature to display multiline append fields.



 



Nintex Form: Append Changes to Existing Text not d... - Nintex Community



 



There are two parts to the workaround.  The second part is that any time someone adds a new note to the append field, a workflow adds the new note, user name, and timestamp to a separate column.  That part's fairly straightforward.



 



The first part is that all the existing notes from the history need to be pulled and added to the new column.  I've actually already done this in SharePoint on Prem, and am just looking for the corresponding action to keep this functionality after migrating to SharePoint Online.  If everything goes perfectly, I won't need to ever run this workflow again, but I want to keep it, just in case.



 



The REST API works fine for me in the browser.


Hi @ab50439 



 



1a. If the REST API works in your browser. You should be able to use the "Call HTTP Web Service" action.





Configuration



Address: <Same as what you use in the browser>



Request Type: Get



Response Content: <Saves the results>



Response Headers: <Headers>



Response Status Code: <returns 200 if OK>





1b. Create a Loop to make a Call for each item ID. 
Replace the "items(1)" with a variable "items(<int_Counter>)"



1c. Process the Response Content variable value.



 



Just be aware of that the the default SPO keeps 50 versions of the item. 



 



Since this is a one-time thing - its possible (and probably faster) to write a script to retrieve the version history. 



 



Cheers



 



 



 



 


I don't have a "Call HTTP Web Service" action.  Is this something that an admin needs to install, or would we need a newer version?


Hi @ab50439 



 



You are using SharePoint 365. Which Nintex Platform are you using?
I'm using Nintex Workflow O365


I think it's the same. The About window says "Nintex Workflow for Office 365". No version number though.


Hi @ab50439 



 



Check with your Admin...



Perhaps your Nintex Admin has disable some features



 



Refer to this article



https://community.nintex.com/t5/Best-Practices/Action-Availability-access-and-usage/ta-p/96210


Thanks for the help so far, Garret.  The admins were reluctant to turn on "Call HTTP Web Service" because no one in the organization has been successful in getting it work.  But I said I wanted to try.



 



It might be working, but the challenge is that instead of returning the raw XML from the REST request, it converts it into a "Dictionary" object, for which there is almost no documentation.  



 



Looking at the XML, the root tag is <feed>.  Using the "Get an Item from a Dictionary" action, and setting the path to "feed", I would have expected this to give me all of the items in the history, but instead I get blank.  Also based on the XML, I would think that "feed/entry(0)/id" would give me the URL to the first history entry, but instead I get blank.  Everything I try either gives me blank or an error (for example "An unhandled exception occurred during the execution of the workflow instance. Exception details: System.FormatException: The DynamicValue property '/Updated' was incorrectly formatted.").  



 



Is there any info on how to use "Get an Item from a Dictionary" to actually get results?


Hi @ab50439 



 



Dictionary is deemed as an Advanced topic. 



 



A Collection is basically an Array of Data



["apple", "pear", "grape"]   // Has 3 items - apple, pear, grape



 



A Dictionary is a Key-Value type of Data structure (Similar to JSON)



["fruit" : "apple", "person" : "john"]



// Has 2 items - fruit-apple and person-John



// Key is fruit, Value is apple



 



btw the result which you are getting back is in JSON format.



 


I understand conceptually, but I can't get the "Get an Item from a Dictionary" action to return anything.



 



For example, how do I get the ID that contains asterisks from the XML below?  I tried "feed/entry(0)/id"  but this gave me blank.



 



<?xml version="1.0" encoding="utf-8"?>

<feed xml:base="https://collaborate.wellpoint.com/teams/ProvRptTest/_api/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">

<id>e5f63794</id>

<title />

<updated>2022-09-19T18:31:58Z</updated>

<entry>

<id>https://****************************************</id>

<category term="SP.ListItemVersion" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />

<link rel="edit" href="SP.ListItemVersionf8b1e21d" />

<title />

<updated>2022-09-19T18:31:58Z</updated>

<author><name /></author>

<content type="application/xml">

<m:properties>

<d:Notes m:null="true" />

</m:properties>

</content>

</entry>

<entry>

<id>https://....</id>

<category term="SP.ListItemVersion" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />

<link rel="edit" href="SP.ListItemVersion28c8fbb9" />

<title />

<updated>2022-09-19T18:31:58Z</updated>

<author><name /></author>

<content type="application/xml">

<m:properties>

<d:Notes>Fourth note</d:Notes>

</m:properties>

</content>

</entry>

Hi @ab50439 



 



/feed/entry/id





 


That would be reasonable, but no:



Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.FormatException: The DynamicValue property '/feed/entry/id' was incorrectly formatted. 


I think it doesn't like the leading slash, but if I remove it, making it feed/entry/id, then I get blank.


You could fall back to using Regular Expression or "Regex" to search for the string


Okay, you're proposing a workaround.  The challenge here is that the Regex would have to be built based on the JSON, not the original XML.  I can't see the full JSON to know how to build the Regex.  The "Log to History List" action only shows me the first 255 characters.



 



And from what I can see of the JSON, I really don't understand how the conversion is happening.  It doesn't appear to line up with the XML.  I expected the first object to be "XML" or "feed", but instead it's something called "odata.metadata".  This holds something like a URL to the REST command, but not the exact URL that I used.  The second object is "value" and it holds an array that I can't see much of.


Hi @ab50439 



 



Yup, The "Log to History List" action only shows the first 255 characters.



In order to overcome the 255 char limit, just use a Send Email action. Insert the variable into the email body.


Thank you for the suggestion.  By emailing the text of the dictionary object to myself, I was able to view the full JSON and create a "Get an Item from a Dictionary" path that actually works.  The path that I thought would be "feed/entry(0)/id" actually had to be "value(0)/odata.id".  



 



If anyone from the future is reading this, don't try to figure out the dictionary path based on the XML.  It's unpredictable.  You need to view the JSON to figure out the path.


Reply