SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to use sharepoint foundation 2010 as file store for a website. Every document update must go thru an approval cycle and finally gets to a approved status to show up on the website for end users. When a document is updated in sharepoint the status is reset to "Draft" even if the previous version was approved. This is the intended behavior.

File.Versions gives me the list of versions.

How to get the version that was last "Approved"?

share|improve this question
By Client OM do you mean C# OM or rahter Javascript OM? The JS OM does not allow to my knowledge Versions access, rather through the use of SOAP Web Services – Marius Constantinescu - MVP Jan 12 '14 at 14:15

If you loop through the File.Versions you can find the one with the IsCurrentVersion property set to true. That should be the most recently approved version.

share|improve this answer

Please use below code and this will give latest approved version.

SPList oList = new SPSite("http://developerBOX1").AllWebs["Web1"].GetList(
SPListItemCollection collListItems = oList.Items;
SPListItem itemFound;
if (oList.EnableVersioning){
    foreach (SPListItem oListItem in collListItems)
SPListItemVersionCollection allVersions = oListItem.Versions;          
// Iterate through all versions         
foreach (SPListItemVersion version in allVersions){
    if (version.Level == SPFileLevel.Published){
        itemFound = version.ListItem;
share|improve this answer
Thanks.. trying to find SPListItem in CLOM. is this from Webservices by any chance?? – Bhuvan Apr 3 '12 at 22:08
hi bhuvan the CLOM encapsulates sharepoint webservices and gives you a ease of use API – Sebastien Stettler Apr 4 '12 at 7:42
You can write this code in a web service and use this services in your website. I hope this will help you – Yogi Apr 4 '12 at 12:22
Hi Bhuvan, Will this solution help you in your requirment, Please let me know? – Yogi Apr 4 '12 at 14:05
The confusion is that the question specified the use of the Client Object Model (CSOM) and the answer given shows code from the Server Object Model. – Rob Windsor Aug 24 '13 at 2:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.