Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7845527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:15:15+00:00 2026-06-02T17:15:15+00:00

I am trying to use sharepoint foundation 2010 as file store for a website.

  • 0

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”?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T17:15:17+00:00Added an answer on June 2, 2026 at 5:15 pm

    You will need to loop through the versions of the ListItem and find the latest one that has been Published. Use the SPListItemVersionCollection to loop through the versions and check the SPFileLevel

    As per the Sebastian Wojciechowski’s community addition for the MSDN article on SPListItemVersionCollection

    SPListItem.Versions[0] //this is current version of the item
    SPListItem.Versions[1] //this is previous version of the item
    SPListItem.Versions[SPListItem.Versions.Count - 1] //this is first version of the item
    

    the versions are indexed in reverse order (newest to oldest) thus your code will be something like:

    // Retrieve all versions
    SPListItemVersionCollection itemVersions = item.Versions;
    for (int i = 0; i < itemVersions.Count - 1; i++)
    {
        // Check if version is published
        if (itemVersions[i].Level == SPFileLevel.Published)
        {
            return itemVersions[i];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i trying to change document content type. I must use workflow, and the best
I'm trying to implement a customization in SharePoint 2010 so that when a document
I was trying to use ajax control toolkit in sharepoint 2010, but i get
Using SharePoint 2010 I am trying to use the SPWebConfigModification class to make some
I'm trying to use the sharepoint API to deploy some solutions and the global
I'm building a custom web part for SharePoint and I'm trying to use the
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
I'm trying to use PowerShell with SharePoint. I'd like my PowerShell scripts to load
I'm trying to use the Admin webservice of SharePoint 2007 within a console application.
I have an InfoPath form in a SharePoint workflow. I'm trying to use a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.