Proper way to get the latest published Major version of Document

Hi,
I have a Document Library which has "Create major and minor (draft) versions" enabled.
Now, from my C# application I need to fetch the latest major version of a document from that library.
What is the proper way to do this?
As of right now, I do the following:
return sourceFolder.Files["documentName.docx"]; // sourceFolder is a SPFolder object
Now, I don't trust that this will always give me the latest published major version of the document. Or am I wrong? If I'm wrong, how should I do this?
Thanks!

Problem
When you store critical documents in the SharePoint libraries, sometimes it becomes necessary to track all the changes and to maintain version history for them.
Solution
There might be a time when you would need to restore files back to an older version if any inadvertent change happens. You can also track changes for auditing purposes.
So how does SharePoint allow creating different versions of documents? How does version history work? What are the different types of versions we can maintain for our library or list and how can we revert back to an older version?
SharePoint allows you to enable (by default it's disabled) versioning on lists and libraries. Once enabled, SharePoint will maintain multiple versions of the document or list which gets incremented on each change iteration. There are three different versioning
settings:
No versioning - This is the default setting in which the current version overwrites the older version. There are no previous versions stored. This setting is not recommended especially if your document library contains critical or important
documents.
Create major versions - Also called simple versioning, in this setting the document versions will be numbered with whole numbers, called major versions, i.e. 1, 2, 3, 4 etc.
Create major and minor (or draft) versions - In this setting document versions will be numbered with whole numbers (1, 2, 3, 4 etc.) as well as numbers with decimals (.1, .2, .3, .4 etc.). The whole number is called the major version
(indicates final copy) and the numbers with a decimal are called minor versions (indicates work is still in progress). You use this setting if your document goes through several iterations/drafts/reviews (minor versions) and you want only the final copy (major
version) to be published to a broader audience.
Please note for a list or list items, the only option available for versioning is creating major versions, no minor versions are created.
Once versioning is enabled SharePoint automatically and transparently creates the next version of the document whenever a user updates a document in the library. These are some of the different scenarios when SharePoint will create a new version for your
document or list item:
When a new document or list item is created or uploaded into SharePoint, version 1 is created if the option
Create major versions option is enabled or version 0.1 is created when
Create major and minor (or draft) versions is enabled (not applicable for list items) and when you publish it then next higher major version is created.
When you upload a document with the same name as an already existing document in the library and check the
Add as a new version to existing files check box, the existing file becomes an older version and the new uploaded document will have next higher version number.
When any properties (metadata fields) of the document or list item is changed.
When you Check-in a document that was previously Checked-out.
When you open a document in the associated application, edit and save it for the first time. On subsequent changes no new versions will be created as long as you don't close the application and re-open it.
When you restore the old version of the document.
Please note, although the demonstration in this tip has been shown in SharePoint 2010, the versioning feature has been part of previous SharePoint versions as well.
Reference URL with Example :
http://www.mssharepointtips.com/tip.asp?id=1047
Thanks
Jaison A

Similar Messages

  • My school's blackboard does not yet support firefox5.0 but if supports all of 4.x, how do I get the latest 4.x version?

    I would like the latest version, but it will cause problems taking tests in the blackboard app. for my school. How can I get the latest 4.x version?

    Firefox 4 isn't supported, Firefox 5 was security update for Firefox 4. Firefox 3.6.x versions are still supported by Mozilla, so it would be best to stick with that for the time being for your BlackBoard website.

  • Is there any way to get the latest equipment? ( The Verizon anti-loyalty program.)

    My DVR is the old 80GB model. The new 500GB model has been available to "new" customers for some time now. Current customers can only get on a "someday" waiting list. Full story below. Incidentally, this is the worst treatment I get from any service I pay for from any vendor. If I could get fiber from anyone else, I'd dump Verizon.
    I am extremely unhappy with my FIOS service and the general treatment I have received in the last month. I have been a loyal customer of Verizon FIOS for a long time, years, I was an early adopter. I called in December (my contract was up again) and in order to renew I asked for an equipment upgrade (my DVR is too small). I was promised an upgrade and renewed my contract. I was sent to different boxes containing the same equipment I already have (which I returned). After many hours online and on the phone sorting this out of 2 weekends we finally sorted out the problem. The requested DVR model I was promised and have asked for since early December is only being given to NEW customers. As a loyal customer who has given Verizon thousands of dollars, I am punished by being denied access to modern equipment. I was told as a current customer I could sign up on a waiting list and someday the equipment will be offered to older customers (I can only assume after every new customer in the world signs up). I was alternately told by a customer service rep that the only way to get what I asked for is to rip out all my current equipment, send it in, make and wait for new installation appointments, and become a new customer. THIS IS UTTERLY REPUGNANT. I have been with Verizon for years.  I believe I am not less important that anyone off the street that wants to sign up. Is Verizon willing to do anything at all about this? Is this my reward for years of paying Verizon, to be treated like a second class customer and offered untenable options??? I feel after all my loyalty and lots and lots of cash over the years I deserve the same thing as any other customer.

    transon wrote:
    not sure I understand. You're spending your own money to buy a Tivo to use a service Verizon provides? Like instead of expecting them to keep your equipment up to date? (or at least allow you options equal to all other Verizon customers)
    I have one TiVO HD now, and adding another would be great. Have you ever used a TiVO guide and actually got what you wanted to record? I pay TiVO $9.99 a month because my commitment is up, and Verizon $3.99 a month and get everything but Widgets I don't want. VOD they charge to much for, Remote DVR programming that only works when you don't need it. I have a 1TB internal drive I installed. Get my point?
    Under $15 a month and does everything I want. I thought I missed the VOD untill I got it back for 2 months and decided I didn't need it. Multi Room, don't need it. Tried it once and canceled it. The only reason I have MRDVR now was to get the discounted HD boxes which they do now anyway. Shame they started that a month after I picked up the VZ DVR.
    I did sugest that Verizon partner with TiVO and cut their development cost, and that was given a not likely response. Yea if Verizon offered a TiVO with the guide TiVO provides, TiVO VOD options, Verizon VOD options, Verizon Widgets, I would give Verizon $20 a month no problem.
    I had a Verizon 6216 DVR for 4 years, a TiVO still for over a year, and now a 7216 for about 2 months. I like TiVO. Sorry Verizon.

  • Any way to get the latest 12.5.4 patch?

    Dear all,
    today we ran an issue with a procedure that occoured only on our 12.5.4 VM (12.5.4 EBF 16791 ESD #10 Win32), a that runs like a charm on 15.7.
    Now, we know that ASE 12.5.4 is deprecated, nevertheless it would help us a lot, if we'd have the latest 12.5.4 patch avaliable (ESD#11?).
    Unfortunately, SAP Marketplace does only offer patches from 15.5 on,
    Could you give me a hint? Any help will be appreciated,
    All the Best
    Arthur Kirchner

    In fact,
    SAP keeps archived versions of their software and there are no nefarious ways needed to find them. What we needed was our senior systems specialist to provide us with the link to archive though: Archive | SAP Support Portal
    All the Best

  • How can we get the Latest Resource Assigned in the Approval Form

    I was wondering if there is any way to get the Latest Assigned Resources to a User in my Approval Form.
    I tried this <ref>waveset.resourceAssignments</ref> but it returned all the Resources assigned to a User. While creating a User with Resource Assigned it won�t be problem. While Update when a User is assigned a Resource & it comes for Approval to the owner, all the Previously assigned resources shows up. How can I get only the Latest Resource Assigned.
    Can anyone provide some hints on this..

    idm_guy, if you could elaborate more on what you mean with latest resource assigned it would help - but there are a number of options (if i interprent you correctly to solvethis). My guess is that the easiest way would be to determine if:
    waveset.accounts[<iterate through resources>].created = true or false
    and if
    waveset.accounts[<resource>].lastPasswordUpdate = <last updated date>
    The latter is of course only applicable to resource where you set a password. This value will be updated whenever you set the password and could be a possible value to check against.
    If the account is not created yet but assigned it might be another possibility to check, but again - clairfy a bit about what you mean with "Latest Resource Assigned".
    /Anders

  • What is the best way to get the end of record from internal table?

    Hi,
    what is the best way to get the latest year and month ?
    the end of record(KD00011001H 1110 2007  11)
    Not KE00012002H, KA00012003H
    any function for MBEWH table ?
    MATNR                 BWKEY      LFGJA LFMON
    ========================================
    KE00012002H        1210             2005  12
    KE00012002H        1210             2006  12
    KA00012003H        1000             2006  12
    KD00011001H        1110             2005  12
    KD00011001H        1110             2006  12
    KD00011001H        1110             2007  05
    KD00011001H        1110             2007  08
    KD00011001H        1110             2007  09
    KD00011001H        1110             2007  10
    KD00011001H        1110             2007  11
    thank you
    dennis
    Edited by: ogawa Dennis on Jan 2, 2008 1:28 AM
    Edited by: ogawa Dennis on Jan 2, 2008 1:33 AM

    Hi dennis,
    you can try this:
    Sort <your internal_table MBEWH> BY lfgja DESCENDING lfmon DESCENDING.
    Thanks
    William Wilstroth

  • Where do I get the latest version & patches for BI Publisher?

    ..we're currently on 5.6.3.
    ta.
    Steven

    5.6.3 is the major version, but you can patch up to get the latest functionality, e.g. 7352374 for bursting.
    Search on BI Publisher in Patches on MOS.
    Regards,
    Gareth

  • What is the best way to "upgrade" a powerbook g4 with a powerpc chip?  it seems that many things don't work or aren't supported these days.  can't update my iphone, download video, etc.  can i get the latest software?  thanks.Ask your question.

    what is the best way to "upgrade" a powerbook g4 with a powerpc chip?  it seems that many things are not supported these days.  can't download software, update my iphone, download video, etc.  can i get the latest software?  thanks for the help!

    Mac OS X 10.5 Leopard installation system requirements
    http://support.apple.com/kb/TA24950
    Leopard is no longer available at the Apple Store but may be available by calling Apple Phone Sales @ 1-800-MY-APPLE (1-800-692-7753).
    If you can't obtain a retail install DVD from Apple, look on eBay or Google the installer part numbers to possibly find at an on-line store. Here's what to look for:
    MB427Z/A  Leopard 10.5.1 install DVD
    MB576Z/A  Leopard 10.5.4 install DVD
    MB021Z/A  Leopard 10.5.6 install DVD (single user)
    MB022Z/A  Leopard 10.5.6 install DVD (5-user family pack)
    Installing Mac OS X 10.5 Leopard
    http://support.apple.com/kb/HT1544
    Mac OS X 10.5 Leopard Installation and Setup Guide
    http://manuals.info.apple.com/en/leopard_install-setup.pdf
    After you install the base 10.5, download & install the 10.5.8 combo update at http://support.apple.com/downloads/Mac_OS_X_10_5_8_Combo_Update
    The DVD should look like this
    Caution - Leopard does not support classic mode. So, if you currently open OS 9 apps in classic mode, you won't be able to do this if you upgrade to Leopard.
     Cheers, Tom

  • What is the proper way to open the app store  for ios

    Using Air3.1 to develope a game.
    I want to have links on my main menu which will open the iOS app store for a specific application.
    The only way I have found to do this is by opening a url "http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=<THEAPPIDHERE>&mt=8"
    However, while this does work, so to speak, when I try to go back to the application, it starts up as if it had crashed... and it does several "redirects" before it get's where it is eventually going.
    Is there a better/proper way to open the app store?
    Cheers
    dave

    Read this page, especially the later examples:
    http://bjango.com/articles/ituneslinks/

  • How to get the latest update time of a info provider in ABAP

    hi experts,
    i am doing a ABAP program and need to get the latest update time of a info provider , does anyone know where it stores in BW or any other way to get it?
    many thanks
    WHY

    Table : RSREQDONE
    you can give INFOPAK_ID as parameter and search for latest/last Request ID and dispaly time and Date.
    Cheers
    Praveen

  • What is the proper way to move the iTunes (v11) Media folder to an external USB HD?

    What is the proper way to move the iTunes (version 11) Media folder to an external USB HD?  I have tried to following listed instructions, but although I can get the songs listed, their locations are not found.

    Tried the option key, but it would not let me select the copied iTunes folder.  Also changed the path for iTunes Media Location folder.  But still iTunes is not happy.  I could try the alias route, but I don't have an iTunes folder that iTunes is happy with to point it to.  All of the songs and even the playlists will come up, but it seems some form of the folder and its files must remain on the internal hard drive.  But I want to move it off because it is out of space.  Any other thoughts?
    I have all of the music etc files what I do not want to lose is the playlists.  I don't care about the play counts.  I would be glad to reimport all of the songs to the newly designated folder, but won't I lose my playlists?
    Thanks for your help.

  • What is the proper way to use the write method?

    What is the proper way to use the OutputStreams write method? I know the flush() method is automatically called after the write but i cant seem to get any output
    to a file. The char array contains characters and upon completion of the for loop the contents of the array is printed out, so there is actually data in the array. But write dosnt seem to do squat no matter what i seem to do. Any suggestions?
    import java.io.*;
    public class X{
    public static void main(String[] args){
    try{      
    FileReader fis = new FileReader("C:\\Java\\Test.txt"); //read chars
    FileWriter fw = new FileWriter("C:\\Java\\Test1.txt"); //read chars
    File f = new File("C:\\Java\\Test.txt");
    char[] charsRead = new char[(int)f.length()];
    while(true){
    int i = fis.read(charsRead);
    if(i == -1) break;
    // fw.write(charsRead); this wont work
    // but there is infact chars in the char Array?
    for(int i = 0; i < charsRead.length -1 ; ++i){
    System.out.print(charRead);
    }catch(Exception e){System.err.println(e);}

    Sorry to have to tell you this guys but all of the above are broken.
    First of all... you should all take a good look at what the read() method actually does.
    http://java.sun.com/j2se/1.3/docs/api/java/io/InputStream.html#read(byte[], int, int)
    Pay special attension to this paragraph:
    Reads up to len[i] bytes of data from the input stream into an array of bytes. An attempt is made to read as many as len[i] bytes, but a smaller number may be read, possibly zero. The number of bytes actually read is returned as an integer.
    In other words... when you use read() and you request say 1024 bytes, you are not guaranteed to get that many bytes. You may get less. You may even get none at all.
    Supposing you want to read length bytes from a stream into a byte array, here is how you do it.int bytesRead = 0;
    int readLast = 0;
    byte[] array = new byte[length];
    while(readLast != -1 && bytesRead < length){
      readLast = inputStream.read(array, bytesRead, length - bytesRead);
      if(readLast != -1){
        bytesRead += readLast;
    }And then the matter of write()...
    http://java.sun.com/j2se/1.3/docs/api/java/io/OutputStream.html#write(byte[])
    write(byte[] b) will always attempt to write b.length bytes, no matter how many bytes you actually filled it with. All you C/C++ converts... forget all about null terminated arrays. That doesn't exist here. Even if you only read 2 bytes into a 1024 byte array, write() will output 1024 bytes if you pass that array to it.
    You need to keep track of how many bytes you actually filled the array with and if that number is less than the size of the array you'll need pass this as an argument.
    I'll make another post about this... once and for all.
    /Michael

  • My ipod is the second Generation, how can i upgrade  to get the latest game apps and such?

    My ipod is the second Generation, how can i upgrade  to get the latest game apps and such?

    You probably can't. Many games and other apps now require iOS 4.3 or later, and iOS 4.2.1 is the last version that will run on a 2nd-gen iPod touch. If you want to run newer games, you'll need a newer iPod.  If you want to look for games that will run on your iPod, here's a tip from another user that may help you:
    "I was running into the same problem trying to find apps for my daughters Iphone 3g running 4.2.1.  What I did was go to the Itunes store through Itunes on my PC, and then went to the bottom of the main page and clicked "Browse." On the browse page I selected, App Store, Games (category), Kids (subcategory), and then a list of apps appears below. 
    I sorted by date (oldest to newest) by right-clicking next to "price" and choosing "release date" on the menu that pops up. The date created field will then be showing, which you can click on to sort newest to oldest or oldest to newest.  I downloaded a bunch of free apps starting from the oldest (by name - you don't have much else to go on).  Of the 30 or so I added to my Itunes, about 27 of them were compatible with 4.2.1. 
    This is defintely not a perfect way of finding apps, but after spending a lot of time searching for a better way this was the best I could come up with."
    You can also check out these web sites:
    https://sites.google.com/site/appleclubfhs/support/advice-and-articles/finding-a pps-for-older-devices
    http://findoldapps.com
    Other posts may provide other tips on how to look for compatible apps.
    Regards.

  • Getting the Latest Transaction

    Hi guyz,
    Just want to ask how will I do this...Is this possible in routine or in the query?
    For example, I have these fields:
    0CALDAY (date of the transaction)
    0CALMONTH
    0CUSTOMER
    ZTRANS (transaction number)
    ZVOL (volume)
    I want to get the latest transaction of each customer for every month..
    How will I do it? The only way I can think is to get the MAX date by looking up in the PSA table and the DSO target..But I think the performance will be very slow..Any other idea?
    Thanks!
    Loed

    Hi Loed,
    I am not sure whether it work or not in your scenario.
    Have a try below logic.
    If data in your transcation number object contains only numeric then create one more infoobject and name it as Transcation Number ( Key Figure , Type Number ) and map earlier Transcation Number to this new Object in your transformation.
    In your Bex , create formula by using this new trancation number object and in Exception aggregation select "last value" and ref charactestic "cal year / month"
    Regards,
    Anil

  • I have an ipod touch (4th gen) and just bought a clock/charger/player.  It says I need ios 4.3.  I keep getting a message saying I can download 6.? but it will wipe out everything on my ipod.  Is there a way to get the ios without wiping out my files?

    I have an ipod touch (4th gen) and just bought a clock/charger/player. It says I need ios 4.3. I keep getting a message saying I can download ios 6.? but that it will wipe everything off my ipod.  Is there any way to get the ios without wiping out my files?

    There is no supported method to "downgrade" iOS on any device.  If you update, you will get the latest iOS for your device, which will be iOS 6.1.3.  You cannot go backwards to iOS 4.3
    If you have never backed up in either iCloud or iTunes, then upgrading to iOS 6.1.3 will involve restoring your device as part of the upgrade.  Without a backup to restore from, you will loose everything that is on it.
    You should first connect to iTunes with your computer, sync your device without upgrading and create an up to date backup of everything.  Then use the upgrade option in iTunes to update your iOS.
    However, if the dock device strictly requires iOS 4.3, it will not work, as you cannot downgrade iOS.  There simply is no mechanism from Apple to do that.

Maybe you are looking for

  • Follow up in IC Agent

    HI experts, I have a requirement where i need to create a follow up of business activity in IC agent  ( BZ ROLE : UTIL_IC ). I have developed objects and even getting correct follow up transaction in pop up. When I select the follwo up from POP UP ,

  • Do I need a power converter to use my USA purchased MacBook Pro 3,1 in Italy?

    Do I need a power converter to use my MacBook Pro 3,1 in Italy?  I've had it for a few years, purchased and used in USA.

  • E3000 wont allow streaming of some video content to IPhone 4s

    I have just upgraded from an E1000 to the E3000 and have run into a couple of problems with my iphone 4s. There are a few applications, BBC iplayer, Sky Go, BBC News and ITV player that wont allow me to watch any of the online video through the iphon

  • Generated files do not rename automatically when doing save book as

    I'm using FM8. Inside of your book, generated files are suppose to rename to your book name automatically when you do a "save book as", the filenames are not changing, does anyone know why this is and what the solution is?

  • Itunes doesnt download purchased music?

    about 6 months ago itunes stopped downloading music I purchased. all the music I buy now builds up and doesnt go from purchased to in my libary. I try "check for Purchases" and it finds all the songs but when downloading it starts and then skips to t