This is a small article about several undocumented query parameters that can be used on SharePoint list view pages to extract and display additional list data, e.g. the previous versions of the displayed list items.
The parameter that forces the display of all versions of the list items is “IncludeVersions”, it can be used like this:
http://someserver/sites/1/docs/Forms/AllItems.aspx?IncludeVersions=TRUE
A big note here – when you click the context menu commands for the list items they will be applied on the latest version of the item, and for document libraries always the latest version of the document will be opened. So the net value here is only the possibility to see the differences between the values of the displayed fields in the different item versions.
[UPDATE: check this posting for a possible work-around]
Another parameter is the “RootFolder” one, especially when the value that is provided for it is the asterisk character – then it forces a flat view of the list items, analogous to the “RecursiveAll” view scope option:
http://someserver/sites/1/docs/Forms/AllItems.aspx?IncludeVersions=TRUE&RootFolder=*
And here is how using the “IncludeVersions” parameter in conjunction with the well known “FilterFieldN” and “FilerValueN” parameters you can display all latest approved versions of your list (as if you are a user with reader rights who can’t see the pending or draft versions, but sees the latest approved versions of the items that are now pending):
http://someserver/sites/1/docs/Forms/AllItems.aspx?IncludeVersions=TRUE&RootFolder=*&FilterField1=_ModerationStatus&FilterValue1=0&FilterField2=_IsCurrentVersion&FilterValue2=1
Note the fields used to filter all versions – the _ModerationStatus and _IsCurrentVersion, the value 0 for the moderation status field corresponds to the approval status “Approved”.
Subscribe to:
Post Comments (Atom)
All nice but when used on a library, opening any document from such a "filtered" view will still open the last (draft) version. Very confusing for users. The very fundamentals of document control and document management seem to be completely overlooked by Microsoft's developers.
ReplyDeleteMr. Stanev's solution, unfortunately, does not solve the issue either...
Hello anonymous,
ReplyDeleteyou are right about that but there is actually a solution to that which is not that difficult - I was thinking about it when I wrote the posting but had never the time to implement it. So the idea is to use a custom computed column - actually a copy of the standard LinkFileName one adding an extra FieldRef for the system _UIVersion column in it and changing the rendering of the link to the document: the link should navigate instead to a custom _layouts page which will receive as url parameters the document's server relative url (FileRef field) and the document's version (_UIVersion field). The custom page will check the document with the object model (plus the provided version) and will either redirect to the current(latest) version of the document (this may be different for users with different permissions though) or an older version using the _vti_history url pattern.
Could you please provide us with more details about the proposed solution to open up the major version of the document. What would the custom page to check the document with the object model look like and could this be achieved using the designer?
ReplyDeleteHello,
ReplyDeleteI demonstrated a similar solution in a separate posting - http://stefan-stanev-sharepoint-blog.blogspot.com/2010/05/how-to-display-all-versions-in.html
the difference is that it opens the exact version of the selected document, but you can easily modify the application page used there to force the opening of the last major version.
Hello,
ReplyDeleteHow is it possible to get the XML of the "?IncludeVersions=TRUE" view.
The User should be able to pull the data to Excel (VBA).
Thanks a lot
you can use a URL like this one to get the list data in XML format:
ReplyDeletehttp://myserver/myseite/_vti_bin/owssvr.dll?Cmd=Display&List={8de2bd36-e998-4a53-9351-c496f4d361a6}&XMLDATA=TRUE&IncludeVersions=TRUE
in the List parameter you should provide the ID of your list
thank you for your post,
ReplyDeleteThere is any solution, to open with link the old version of document ?
Actually, i use http://hostname/Open/EDR-OF-Document. to open the last version, but i don't know, how to open old version (major or minor) of this document.
Thank you in advance
Hi anonymous,
ReplyDeleteyou can check this posting http://stefan-stanev-sharepoint-blog.blogspot.com/2010/05/how-to-display-all-versions-in.html
Hi
ReplyDeleteWonderful post, i tried your method of displaying list data in XML format.It worked well with all types except Task list type and iam using SharePoint 2010.
http://myserver/myseite/_vti_bin/owssvr.dll?Cmd=Display&List={8de2bd36-e998-4a53-9351-c496f4d361a6}&XMLDATA=TRUE&IncludeVersions=TRUE
Hi anonymous,
ReplyDeleteit doesn't work for me either (I checked it on SP 2010 too). And it doesn't work even without the IncludeVersions and XMLDATA parameters. I don't have a clue what it might be and the problem is that even Microsoft most probably won't support this since the RPC protocol (the funny URL-s with the owssvr.dll) has been deprecated since the times of MOSS 2007.
Hi Stefan,
ReplyDeleteThnks 4 u r reply.
The reason y task list type was unable to provide XML result, is due to multi value lookup column. By default, Task list type has field named Predecessors which is a multivalued lookup column. So i think thts the reason. But i could able to get the current task list items as XML but only the versions of the task list items are not coming.
Hi,
ReplyDeleteyes, that seems to be the problem indeed. I knew that when the list view contains a multiple lookup column the view doesn't render the items' versions (when you navigate .../AllItems.aspx?IncludeVersions=TRUE), but it didn't occur to me that it is the same problem here. Still, if you specify a list of fields in the "Query" parameter and there are no multiple lookup columns in the list, it will return a correct XML:
http://myserver/mysite/_vti_bin/owssvr.dll?Cmd=Display&List={ef55d4bd-02f1-4156-884b-ae889fdbf88c}&XMLDATA=TRUE&Query=ID Title
Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain knowledge, would you mind updating your blog with extra information? It is extremely helpful for me.
ReplyDeleteIs there some other option that must be enabled in order for the IncludeVersions=TRUE to work? I've tried adding ?IncludeVersions=TRUE and ?IncludeVersions=TRUE&RootFolder=* to the URL of my document library to no avail. The document library only displays the lastest version. Am I missing something else?
ReplyDeleteThanks
Hi Anonymous,
ReplyDeleteit won't work for sure in SharePoint 2010 which uses the XLV web part instead of the 2007's ListView web part. Also on SharePoint 2007 it doesn't work for views which contain multiple lookup columns (a lookup column with multiple selection enabled). Let me know if your case is one of the above mentioned.
Greets
Stefan
Stefan, great info! I did notice when using IncludeVersions=TRUE in the url it shows versions but it only shows the latest version of the check-in comment and another comment field we are using for status change. Why is that and can it be worked around?
ReplyDeleteThanks
Dave
Hi Anonymous,
ReplyDeleteSorry for the late reply. I also saw that the Checkin comment field always shows its latest version.Probably this has something to do with the fact that this field is an internal lookup field referencing the internal "Doc" list (which is backed by a separate table in the content database). Unfortunately I don't see any work-around for this behavour/feature or at least an elegant and quick one. Possibly a list item receiver can be used to copy the value of the comment field to a hidden note field after every "check in" operation (the update operation should be performed using SPListItem.SystemUpdate(false) so that you don't create a new version with the "copying" update).
Greets
Stefan
Stefan, Is there anyway that file version information can be displayed for MOSS 2003?
DeleteHi Anonymous,
DeleteI don't have any idea about this in SharePoint 2003, I haven't used it for several years now. Sorry for not being able to help you with that.
Greets
Stefan
Our given information related Sharepoint Consulting is very helpful for Sharepoint Consulting. For More Information Sharepoint Consulting.
ReplyDeleteSharePoint consultants are experienced teams of professionals who expedite SharePoint programming develop robust, business oriented, and highly efficient SharePoint solutions that are Flexible, Modular, Efficient, and User friendly and scalable.
Hi! perfect soltuion in SharePoint 2007!
ReplyDeleteBut in SharePoint 2010it is not running :-(
any idea?
Hi Anonymous,
ReplyDeleteI noticed this as well - I think that it is because of the new XsltListViewWebPart web part, it just doesn't respond to these query parameters.
Greets
Stefan
Is there a way to have "IncludeVersions=True" on a data view webpart ?
ReplyDeleteHi Eli,
ReplyDeleteI am not sure about this - I haven't played with the data view wp trying to achieve the versioning trick.
Greetings
Stefan
Hi all,
ReplyDeleteIn the command text box on the data connections property box in Xl I’ve got the following which at the moment only gives a list of latest version files
{524E0187-B111-4EFG-12RT-E9777CF12A93}{590AD018-88B1-411A-B3AB-537603353A6E}http://xxx.com/sites/Fl/_vti_bin/sites/Fl/Shared Documents/Consolidation Report/
This is the best blog I’ve come across so far in terms of possibly providing a solution – can anyone give me an idea of how to change the command text so it gives a list of all file versions?
thanks
James
SharePoint has come up with its best SharePoint future of Themes. It has many inbuilt themes which you could implement as a part of branding.
ReplyDeleteHmm. This works in terms of producing a view that includes versioning, but when I export that view to Excel or Access, it's back to one row per ID. how do I get the data out for reporting?
ReplyDeleteHI
ReplyDeleteI am struggling in sharepoint site with something where I need an urgent help.
I am pretty new to sharepoint and getting my hands on it.
In my document library, i have columns namely Title, Modified, Modified by, Checked out To. In addition to that i want to create a column called Version which displays the version number of the document uploaded.
Whenever i check out and check-in and as the version number of the document changes, the column should display the most recent version number of the document.
Please help
This technique doesnt work for sharepoint 2010.
ReplyDeleteClick on List Tools--> Select List--> List Settings--> Under Views group click on All Items--> Under column Name find Version and check that checkbox
ReplyDeleteIncludeVersions=True works well for me using owssvr.dll . But if I add a column of type "person or group", like "Assigned To", a single version of the item is displayed. Not the first or the last but seems to be a random one. Anybody know a workaround?
ReplyDeleteHi Stefan,nice post . I'm using Sp2010 and i need to export list items with all the Versions . is there any like PowerShell command that i can use to get all list Versions?
ReplyDeleteGreat post, thanks for sharing...
ReplyDeleteWeb Design India Company
Wordpress Development Company
Does this work in SP2013?
ReplyDeleteDid you ever find an answer to this? I have looked everywhere
DeleteHi Stefan, Thanks for Share with us your valuable SharePoint Tutorial , we are waiting for your next ones ! Keep it up.
ReplyDeleteThanks
This comment has been removed by the author.
ReplyDeleteThanks for the article on showing the latest major version of a document in a document library. Is there a solution for showing the last "major" version, even if I have permissions to see draft documents? An example would be: I have a major version "110.0" of document foo.xlsx in a document library. foo.xlsx has two more minor revisions to get the latest version to "110.2." I'd like a view that just shows the latest major version of my foo.xlsx (and all other "xyz.0" versioned documents. I'm using sharepoint.com, so the latest version of sharepoint.
ReplyDeleteThanks for sharing valuable information.
ReplyDelete