CSOM - Fetching list item version history programmatically

HI,
Is it possible to get the List item version history programmatically using Client Object model?
I have checked these links:
http://www.learningsharepoint.com/2010/07/16/programmatically-get-document-version-history-using-client-object-model-sharepoint-2010/
but was not able to achieve. I am not looking for Document library, but for a custom list.
Thanks

Hi,
In SharePoint Object Model, there is a
SPListItem.Versions property
can help to “Gets the collection of item version objects that represent the versions of the item”.
However, in SharePoint Client Object Model, this property is not available at this moment.
A workaround is that we can create a custom WCF web service for consuming from client side, then in this web service, we can use Object Model to access the versions of a list
item.
About how to
create and a custom WCF web service:
http://nikpatel.net/2012/02/29/step-by-step-building-custom-wcf-services-hosted-in-sharepoint-part-i/
This workaround would not be applied to SharePoint Online cause Object Model is needed.
If there may be some better ideas or solutions about this topic, your sharing would be welcome.
Thanks
Patrick Liang
Forum Support
Please remember to mark the replies as answers if they
help and unmark them if they provide no help. If you have feedback for TechNet
Subscriber Support, contact [email protected]
Patrick Liang
TechNet Community Support

Similar Messages

  • How to Print SharePoint 2010 list Item Version History ?

    Hi Guys  . I have a requirement to implement Print Option to get all the version for list items .
    (I know this can done with CTRL + P J) 
    is there any custom solution to add Print button to custom Version History.aspx ?
    or any other solution that may work .
    txns  

    Hi,
     If you want that functionality, you have edit the Versions.aspx page (refer the below path) and include your print button and javascript to print it. I believe this is the way you can achieve it
    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS
    If you want more information, please let us know
    Sekar - Our life is short, so help others to grow
    Whenever you see a reply and if you think is helpful, click "Vote As Helpful"! And whenever
    you see a reply being an answer to the question of the thread, click "Mark As Answer

  • Export Library/ List Item Version History

    Hello all,
    I would like to save some documents from the SharePoint on a normal disk. In one library version control is turned on. Now I am wondering if it is possible to export the version history
    to an excel or txt file. Does somebody know a way?
    Kind Regards
    Sylwia

    There is no OOB way. You need to use custom code:
    http://suryapulipati.blogspot.in/2010/12/splistitem-doclistitem-null-ur-listtiem.html
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • Document set items Version history

    Hi,
    I'm trying to to retrieve document set version history. here i need to retrieve all modified versions of a document in document set ? Can any body help?
    I have tried but didnt find anyway .. how to get version history of a document in document set.
    Thanks in advance.
    SPSite site = SPContext.Current.Site;
    SPWeb web = site.OpenWeb();
    string ver = web.Url + "/" + sharedDocs;
    //Get the selected document
    SPListItem listItem = SPContext.Current.Web.Lists["Contract Documents"].GetItemById(99);
    if (listItem.FileSystemObjectType == SPFileSystemObjectType.Folder)
    //Get the folder
    SPFolder myFolder = listItem.Folder;
    //Make sure the folder has items
    if (myFolder.ItemCount > 0)
    //For each item get the document name
    foreach (SPFile item in myFolder.Files)
    string name = item.Name;
    foreach (SPListItem vh in myFolder.Files)
    SPListItemVersionCollection coll = vh.Versions;
    foreach (SPListItemVersion version in coll)
    var VersionLabel =version.VersionLabel;

    No Jenkis,, No thats my fault.. I forgot to add code below.
    And I have tried the below code which is fine getting versions but it is not retrieving current version.
    My case, i have a document with versions 1.0, 1.1 but here 
    filecollection.Count is showing 1. that is 1.0 version. Is any other way to get current version?
    SPSite site = SPContext.Current.Site;
    SPWeb web = site.OpenWeb();
    //Get the selected document
    SPListItem listItem = SPContext.Current.Web.Lists["Contract Documents"].GetItemById(99);
    if (listItem.FileSystemObjectType == SPFileSystemObjectType.Folder)
    //Get the folder
    SPFolder myFolder = listItem.Folder;
    //Make sure the folder has items
    if (myFolder.ItemCount > 0)
    //For each item get the document name
    foreach (SPFile item in myFolder.Files)
    string name = item.Name;
    SPFileVersionCollection filecollection = item.Versions;
    if (filecollection.Count > 0)
    foreach (SPFileVersion v in filecollection)
    var VersionLabel =v.VersionLabel;
    Thanks in advance.

  • Retrieve SharePoint List Item version with few columns only

    How to retrieve the version history of the list item in just a few columns just like what we can do with viewfields in spquery which return list item?
    Having performance problem when using splistitem.versions in a big list. When I show only the latest version, the page load much faster.
    teikboon

    Hi,
    According to your post, my understanding is that you had an issue about the version history.
    I couldn’t reproduce the issue in my environment, and I don’t think it’s a known issue.
    Per my knowledge, the version history contains information about when the item or file was changed, who changed it, and information about what was changed. In libraries, the version history might also contain comments written by the people who made changes.
    As you had said, you had seen an update to the value of the new column, did you see who changed it ? Maybe some had changed it.
    Could you reproduce the issue use the other lists? You can check with other lists to see whether it works.
    To quickly and accurately find the issue, I recommend you check with the ULS log to see if anything unexpected occurred.
    For SharePoint 2013, by default, ULS log is at
    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jason Guo
    TechNet Community Support

  • Getting the version history of a list item

    I am creating a content web part and one the list items is used with versioning. I want to show all the versioning on the page. Is there anyway to do this? maybe using CSOM or something. In Javascript

    Hi,
    According to your post, my understanding is that you want to get the list item version using CSOM or JavaScript.
    There is no directly way to get the list item version using CSOM or REST Api, however, there are alternative options as below.
    We can use the SharePoint List web service
    that exposes Lists.GetVersionCollection Method to return version information for the specified field in a SharePoint list.
    There is a code demo to retrieve the List1 item version, it works like a charm, you can refer to it.
    <script type="text/javascript" src="../Shared Documents/jquery-1.11.0.min.js"></script>
    <script type="text/javascript" src="../Shared Documents/jquery.SPServices-2014.01.min.js"></script>
    <script type="text/javascript">
    $(function(){
    $().SPServices({
    operation: "GetVersionCollection",
    async: false,
    strlistID: "Lists_1",
    strlistItemID: 1,
    strFieldName: "Title",
    completefunc: function (xData, Status) {
    console.log(xData);
    $(xData.responseText).find("Version").each(function(i) {
    console.log("Name: " + $(this).attr("Title") + " Modified: " + $(this).attr("Modified"));
    </script>
    What’s more, we can also get request to Versions.aspx page to get the list item version.
    There is an article about this topic, you can have a look at it.
    http://stackoverflow.com/questions/24423657/sharepoint-2013-get-splistitem-versions-via-rest
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Version History is not working

    Hi All,
    I am working as a SharePoint Developer 2010,
    After Customization of Display page, when i click on time  stamp it is showing current data not version data.
    Please help me on this
    Thanks & Regards,
    Santhoshi.

    Hi Santoshi,
    Please go through below thread to get version data programmatically.
    https://social.msdn.microsoft.com/Forums/sharepoint/en-US/a382321a-a077-485c-8431-e9e3b131d740/list-version-history-programatically
    Using CSOM
    http://sharepoint.stackexchange.com/questions/27346/how-to-programmatically-retrieve-item-version-history-from-client
    Hope this will help you.
    Regards
    Soni K

  • [Oracle Forms 6i] : conflict properties between datablock and list item

    hi
    i have a datablock which contains a list item. my list item is filled programmatically.
    the user needs to be able to change the values in that list item.
    well the problem is that the user can't change the value in my list item when the property INSERT_ALLOWED of the data block is set to false.
    i need this property to be set to false, cause it disable the green button up on my form
    aparently when this property is set to false, i can't change the value of my list item
    help please !
    thx
    Dan

    I couldn't understand this portion
    'i need this property to be set to false, cause it disable the green button up on my form'
    Can you explain what exactly you mean by disabling the green button?

  • Get the Version history of a sharepoint 2013 Custom List item

    Hi All,
    I am having doubt to retrieve the field version information with the comments.
    For this field i am done like this
    1.Creating a custom list
    2.And enable versioning for the list
    3.And add a field with field type 'Multiple Lines of Text' and in the Addition Column Settings section 'select yes radio button option in 'Append changes to the Existing text'.
    4.If we done like this the changes to the list item are available outside of field control.
    Can any one help me regarding this field to get the all the versions of list item along with modified data.

    hi Asatish,
    Thanks for posting your issue, Kindly browse the below mentioned URLs to know about the fixes of this issue
    http://berg-henry.blogspot.in/2010/11/custom-list-form-with-version-history.html
    http://somnathmatere.blogspot.in/2013/10/sharepoint-2010-custom-display-form.html
    http://blog.qumsieh.ca/2009/01/29/understanding-the-append-changes-to-existing-text-option/
    I hope this is helpful to you, mark it as Helpful.
    If this works, Please mark it as Answered.
    Regards,
    Dharmendra Singh (MCPD-EA | MCTS)
    Blog : http://sharepoint-community.net/profile/DharmendraSingh

  • List items archival with version history using powershell

    HI
    Is there any way to work with site and content structure in SharePoint 2010 with power-shell.
    I want to run a automated task(power shell script) to move list items from source to destination in the same site with version history.
    I know i can do it from site and content organizer but i have to do manually and SharePoint designer workflows doesn't retain the version history.
    Please give me  your valuable tips.

    Hi Manikanta,
    Archive ListItem with Version History in SharePoint, I suggesting you the best links for your solution here
    http://techno-sharepoint.blogspot.sg/2012/10/moving-sharepoint-list-items-to-archive.html
    http://get-spscripts.com/2011/10/copy-sharepoint-lists-and-document.html
    For more details, reach us at
    <a href="http://staygreenacademy.com/sharepoint-2013-training/">SharePoint 2013 Online Training</a>

  • SharePoint 2010 : How to display ALL Version History of a list item's multiline text box in a same list as a list view column?

    In SharePoint 2010 , I have version history enabled multiple text box 'issue details'.  Users mainly uses Data Sheet view and it does not show all version history of that multiple line text box, is there anyway we can display list view column in
    data sheet view to display all version history?
    2) If we can not display in datasheet view, in standard view, it should display all version history instead of just a link  to -view all entries'
    I have found one article here and it posts to use below line of code in sharepoint desinger
    <SharePoint:AppendOnlyHistory runat="server" ItemId="{$thisNode/@ID}" FieldName="Issue_x0020_Details" ControlMode="Display"></SharePoint:AppendOnlyHistory>
    WHen I use this line of code , it displays multiple line of same version history instead of each, please help.

    Hi
    Greetings. Hope it helps 
    https://social.technet.microsoft.com/Forums/sharepoint/en-US/d1be5434-7dc9-4941-bf1d-8c12d7e6a155/display-version-history-in-list-view-column?forum=sharepointcustomizationlegacy
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • Version History for a Document Library - Can't view version history for only 1 item

    It is a Document Library with around 8 items. Each of the items have around 60-178 versions.
    I checked programmatically that this particular item had 63 versions.
    I am getting the foll. error when I try to view the version history for that 1 particular item.. it works for all other items in the same list.
    Unable to complete this operation.  Please contact your administrator.   at Microsoft.SharePoint.Library.SPRequestInternalClass.GetFileVersions(String bstrWebUrl, String bstrFileUrl, Object& pvarVersions, UInt32& pdwcVersions)
       at Microsoft.SharePoint.Library.SPRequest.GetFileVersions(String bstrWebUrl, String bstrFileUrl, Object& pvarVersions, UInt32& pdwcVersions)
    This is what I tried so far..
    I tried programmatically deleting few verisons for this item - no luck.
    I ended up deleting all the versions for this item - still I get the same error.
    I tried editing other items to see if their version history still works after new versions get added and it worked.
    This is despite the fact that other items that are working have number of versions  as 178, 130, 63 and so on.
    I appreciate any help.
    Thanks.

    Mike, 
     I don't think it is a programming question. It's a sharepoint browsing question.
    I have a document library with Versioning set to Create major versions.
    In that document library, I have around 8 documents, each of which has versions. Only for 1 particular document, when I try to see the versions by clicking 'Version History', I get the error as stated above.
    For all other documents, Version history works.
    My initial thought was that may be the document in question had too many versions and that's why it's failing but I was able to check that the document (in question) had 63 versions while there are still other documents in the same list which has 178 versions and 'Version History' is still working.
    I further explained all my efforts done so far in order to resolve this issue (none of which worked.)
    I deleted all versions (I couldn't delete it from IE since I can't even get to the page where it says 'Delete All Versions' - thus I wrote a small program to delete all versions for this document.)
    I also tried modifying other documents to see if a version history is being created for other documents and that is happening.
    Thanking you in anticipation..

  • Deleting a List Item with Very Huge Amount of Versions

    A faulty workflow flooded list items with 50K+ versions on SharePoint List. Attempts to open the list item/delete/edit via SharePoint UI/PowerShell failed! Programmatic iterations to delete versions/items trys to consume complete server memory and
    fails.
    Deleting the complete list is successful, but that results in SharePoint timer jobs fail and places Lots of Block in the database, which stops SharePoint sites from loading.
    Any help please?

    SP 2010 and 2013 support a max of 50,000 versions. Accessing more than 5000 items at a time causes SQL Server to escalate from row locks to table locks, which will generally bring SharePoint to a stop. You will need to write code that can bring back subsets
    of the data, and the only approach I can think of is a CAML query. But, I can't find any examples of working with versions using CAML.
    You could just change the Throttling settings in Central Admin from the default of 5000 to 50000 and then run your code during off hours.
    Mike Smith TechTrainingNotes.blogspot.com
    Books:
    SharePoint 2007 2010 Customization for the Site Owner,
    SharePoint 2010 Security for the Site Owner

  • ECMA/CSOM script to update multiple list items

     i am trying update multiple list items using CSOM/ECMA script but it updates only first record. can help out .how to update multiple list item records 
    Note(sharepoint hosted APP) only client side coding solution 
    function updateListItems() {
    var itemArray = [];
    var clientContext = SP.ClientContext.get_current();
    var oList = clientContext.get_web().get_lists().getByTitle('TestList');
    for(var i = 1; i<= 5; i++){
    var oListItem = oList.getItemById(i);
    oListItem.set_item('Title', 'My Updated Item!' + i);
    oListItem.update();
    itemArray[i] = oListItem;
    clientContext.load(itemArray[i]);
    clientContext.executeQueryAsync(onQuerySucceeded, onQueryFailed);
    function onQuerySucceeded() {
    alert('Items Updated');
    function onQueryFailed(sender, args) {
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    updateListItems();

    Have a look at the following link for your reference
    https://social.msdn.microsoft.com/Forums/office/en-US/fc91b7b5-6300-4302-af93-4fc697131ec5/client-object-model-update-multiple-list-items?forum=sharepointdevelopment
    You can modify CAML query to fetch rows that you want to fetch.
    Geetanjali Arora | My blogs |

  • Report workload by calculating how many versions of SharePoint list items created in a certain time period

    I have a total of 66 SharePoint 2010 lists - yes, 66! - each lists contains between 1500 and 3200 list items.  My employees update these various list items throughout their workday.  Each update to a list item creates a new version of the list
    item.  On average each list item will have anywhere from 5 to 10 versions before it is done.  I need to create a report that tells me how many list items they've updated in a certain time frame.  I have come close but still cannot arrive at
    the data I'm looking for. 
    This is what I have so far:
    I've created a report using SQL Report Builder 2008 v3 where I've filtered it to show only items MODIFIED between, for example, Feb1 and Feb28.  Of those records, I want the report to tell me how many versions were created during that time
    frame.  The result is one list item with 5 total versions.  Versions 1.0, 2.0, & 3.0 were created on 12/12/14.  The last two versions, 4.0 and 5.0, were created on 2/24/15.  Therefore, the answer I'm looking for is 2 because they
    created 2 versions between Feb1 and Feb28.
    However I get the following results using these queries:
    If I do a =Sum(Fields!owshiddenversion.Value) in the expression field I get the total versions which is 5
    If I do a =Count(Fields!owshiddenversion.Value) in the expression field I get the instance which is 1
    Is there a way to count ONLY the number of versions created in a time period?  Is there another hidden field in SharePoint that I can use in the expression that will give me results I'm looking for?

    Hi Rafael70,
    Per my understanding that you have already get all the need fields and informaiton of the updated version of list items and now you want to calculate how many versions of SharePoint list items created in a certain time period, you can't get desired result
    using sum and count function, right?
    I have tried to tested on my local environment but because I am not clear what is value in the field "owshiddenversion", I assumed you have two datatype parameters (StartDate and EndDate) to help filter the report in a certain time period.
    Generally, if you have add the filter correctly, it will filter the correct number's updated version in this time period, I would like you to provide details information as below to help better analysis the requirements:
    Could you please provide sample data of the table.
    Please provide snapshot of the report structure you have currently designed.
    Please try to provide all the expression you have used.
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

Maybe you are looking for

  • Prob. in execution of t-code

    I have created t-code for executable programm...when i put this t-code it shows respective transaction but at the time of execution it exits to sap easy access screen...what should i do??

  • DAQmxTaskC​ontrol

    Hi I have a question regarding this function. If I just use the DAQmxStartTask and DAQmxStopTask when does the task go through the unverified-verified-commited phase. I know I can set each phase myself with DAQmxTaskControl but am wondering if DAQmxS

  • Date picker field shows html code?

    I have a HTMLDB 2.0 app that I have ported to APEX 3.1. I have one field that is a date picker field which has a before regions computation on it that calculates an expiration date. For some reason, the text area shows the HTML code of the page, not

  • How to convert appleworks database

    How to use AppleWorks database in OSX 10.8.4?

  • Jobs fail in xgrid

    Hi there, I've been working with trying to get PP2 up and running for our organization, but with zero luck. I'm able to successfully capture and upload a podcast to our server, but the job always fails while being processed in xgrid. PP2 is setup to