Check if file version is minor or major server side

Hello ,
How to check that the first version of a file is being written ( minor version 0.1 ) when no major version of file exist.
How to check if file is the last available version ( major version : 1.0 ) ?
How to check if a another version of the file is being written when a major version already exist ( major version 1.0 and minor version 1.1) ?
Any help will be appreciated.
Thanks

Hope it may help
//Open the web
SPWeb web = new SPSite("http://karthickmain:9091/sites/siteb").OpenWeb();
//Get the folder
SPFolder folder = web.Folders["Shared Documents"];
//Get the file
SPFile file = folder.Files["abc.doc"];
//Get all the versions
SPFileVersionCollection versions = file.Versions;
//Get the first version
SPFileVersion version = versions[3];
//Get the data
byte [] dBytes = version.OpenBinary();
http://blogs.msdn.com/b/karthick/archive/2006/03/28/563045.aspx
http://blog.concentra.co.uk/2012/12/03/dealing-with-sharepoint-file-versions-programmatically/
http://paulryan.com.au/2012/spfileversion-gochas/
Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

Similar Messages

  • JDev-SCM Check Out File Version

    When using the RON, I have been able to successfully check out a specific version of a file using the graphical Version History Viewer (and right clicking on the appropriate node).
    When attempting the same within the 9i JDeveloper IDE, however, this functionality does not appear to work the same/correctly? The node turns blue (and SCM believes the file version is checked out), but JDeveloper does not appear to reflect the same....the icon in the System Navigator does not change to indicate the file's checked out status and the specific version of the file is not written to the workarea's download directory (as is the case with the RON)....?

    This is Release Candidate 2 on Win2K with the Windows Look & Feel. I have tried the Oracle L&F, too, with the same outcome. The same steps in the RON, however, produce the desired result.
    Thanks.

  • How to check Fla file version?

    Hi Guys,
    I installed on my system Adobe flash cs3. but when i opened my Fla file that time getting the following error.
    So how to check the Fla file version??
    Thanks in Advance..
    JaxNa

    FLA Version Checker and Launcher
    http://www.peterelst.com/blog/2005/10/02/flavor-fla-version-checker/http://www.northcode.com/blog.php/2007/07/27/FLA-Version-Checker-and-Launcher

  • JNLP download to check for file version differences

    When the end user of my application clicks on JNLP link, I want to show him a popup " Files have changes, Please clear your cache" in case there is a new deployment. Can some body tell me what exactly to be done ? Do I need to deal with any config parameters or I have to create some additional programs. If so, how that program file will get into action as soon as somebody clicks on jnlp link.
    -Regards;
    SS

    Hi Alex,
    Thanks for your response.
    Yes, I am talking about the files that are mentioned in .jnlp file of Web Start. I understand that if the files change, Web Start will automatically update the client cache. But if the new deployment jars are signed with a different certificate then it cant download at client, it will throw an error to the end user - 'Jars are not signed with the same certificate', unless the client cache is manually cleared. Hence when there is a difference in certificate level, and hence change in jars, I wish to present the end user with a information message that 'Jars have changed, please clear your cache'.
    I hope I am able to explain this time. Please let me know if I need to explain my requirement any further.

  • How can i check the file  which is upload from  the server

    when upload the excel file from the server file to the internal table ,how can i check the data whether it accord with  the required condition .
    for example ,i want to upload the file which have the data whose type is pack, and it have three integer and  two decimal ,how can i check in my code.
    thanks,

    Hi Sichen,
    First upload the file, Then do ur validations and delete the records that doesn't satisfy ur requirements.
    Thanks,
    Vinod.

  • Check file version APXPMTCH.fmb

    I am looking to implement a new patch and it directs me to check the file version of two specific files: APXPMTCH.fmb, APXRMTCH.fmb.
    How can I do this while logged into a Unix shell?
    (Patch #: 5999469)

    It should be there.
    To verify, please login as applmgr user, source the env file, and issue the following:
    $ cd $APPL_TOP
    $ find . –name APXPMTCH.fmb
    And ..
    $ find . –name APXRMTCH.fmbThe above should return the directory path where those files are located.

  • Checking File version

    Hi
    I'm working on a powershell script that will check if a dll files version is correct on lots of servers. To keep it quite basic, I would like to output a warning in red to the screen. This is what I need.
    This is what I have written so far but not sure what the best path to follow is if anyone can advise.
    $xFile = "\\10.1.2.3\c$\Program Files\Company\Server Modules\DataModule.dll"
    $xFileVersion = (Get-Command $xFile).FileVersionInfo
    # Need to put some kind if statement here to check the file version number and warn me if the version is not v1.2.3
    Much appreciated to anyone who can give me a hand
    Matt

    The VersionInfo property is actually capable of returning an accurate file version, but you have to combine four subproperties:
    - FileMajorPart
    - FileMinorPart
    - FileBuildPart
    - FilePrivatePart
    You could compute the version with those each time you need it, but I update the type information for all file objects so that an extra 'PSFileVersion' property is added to all files (so the PS type system does the work for me). On PSv3, you can simply run
    the following command, and all files will have that property:
    Update-TypeData -TypeName System.IO.FileInfo -MemberType ScriptProperty -MemberName PSFileVersion -Value {
    if ($this.VersionInfo.FileVersion) {
    [version] ("{0}.{1}.{2}.{3}" -f this.VersionInfo.FileMajorPart,
    $this.VersionInfo.FileMinorPart,
    $this.VersionInfo.FileBuildPart,
    $this.VersionInfo.FilePrivatePart)
    On PSv2, you'd need to use a
    ps1xml file.
    The WMI solution works great, but here's an alternate one that can be used with Get-Item and/or Get-ChildItem (if you don't update the type information above, you could create a property with select-object that builds this property).
    If you can access remote systems through admin shares, then you could do something like this:
    $FileName = '\\{0}\c$\Program Files\Company\Server Modules\DataModule.dll'
    $ExpectedVersion = '1.0.0.0'
    # This will only output files where the version isn't at least $ExpectedVersion
    # You can change -lt to -ne if you’re looking for the version to be exactly the same
    echo computer1, computer2, computer3 |
    foreach { Get-Item ($FileName -f $_) | select fullname, psfileversion } |
    where { $_.PsFileVersion -lt $ExpectedVersion }
    or this:
    $FileName = '\\{0}\c$\Program Files\Company\Server Modules\DataModule.dll'
    $ExpectedVersion = '1.0.0.0'
    # This will output an object for each computer that has a Pass property that's either true/false
    echo computer1, computer2, computer3 | foreach {
    $ObjectProps = @{
    Computer = $_
    FileName = $FileName -f $_
    if ((Get-Item ($FileName -f $_)).PSFileVersion -lt $ExpectedVersion) {
    $ObjectProps.Pass = $false
    else {
    $ObjectProps.Pass = $true
    New-Object PSObject -Property $ObjectProps
    Of course, you could modify this to be a function that allows you to feed computer names to it. You could also change the first command in the pipeline (echo) to any other command that will give you a list of computer names.

  • Check powershell.exe file version

    I am learning SCCM 2012 and I put together a query to check the file version of powershell.exe to see if the computers are running v2.0 or v3.0. Here is the query. When I run it, nothing shows up. I have a few computers with powershell installed.
    select SMS_R_System.Name, SMS_R_System.LastLogonUserName, SMS_G_System_SoftwareFile.FileVersion from  SMS_R_System inner join SMS_G_System_SoftwareFile on SMS_G_System_SoftwareFile.ResourceID = SMS_R_System.ResourceId where SMS_G_System_SoftwareFile.FileName
    = "powershell.exe" order by SMS_R_System.Name
    When I change powershell.exe to winword.exe I get more than 100+ computers listed. I even give it the file path (C:\Windows\SysWOW64\WindowsPowerShell\v1.0) but it still does not work
    Thanks for your help
    Freddy91761_1

    This might interest you as well
    http://be.enhansoft.com/post/2014/01/15/PowerShell-Inventory-Reports.aspx
    Please remember to click "Mark as Answer" or "Vote as Helpful" on the post that answers your question (or click "Unmark as Answer" if a marked post does not actually
    answer your question). This can be beneficial to other community members reading the thread.
    This forum post is my own opinion and does not necessarily reflect the opinion or view of my employer, Microsoft, its employees, or MVPs.
    Twitter:
    @alexverboon | Blog: Anything About IT

  • How to check the JDK version of a compiled java file

    can anybody tell me how to check the JDK version of a compiled java file ?
    Edited by: gbhatia8 on Sep 9, 2010 7:04 AM

    The major/minor version of the class file is the way to go.
    Also, it's not necessary to write a separate program to get to those. javap prints them out when being passed the -v flag.
    Note, however that "JDK version" is not a correct term, as I can create 1.4-compatible class files with a Java 6 JDK (by passing the -target flag to javac). Those won't look any different than .class files written with a 1.4 JDK.

  • Linux Based Oracle ERP-File Version Check

    hi,
    Anyone can tell how to check the following version of the files in Linux 7.2 ES for ORacle erp 11.5.9
    LoadGraphContext.java
    LoadGraphFetcher.java
    I used java commands but only shows the java version.
    I also need the following files path
    include/wpwors.h
    src/discrete/wpwwwip.lcp

    Manoj,
    Which changes do you see?
    Use tmpfs, change the base address or use bigpages?

  • Remotely checking file versions using PowerShell

    Hi
    Can anyone give me a start. I support many servers and PCs remotely which I have remote access to. I would like to be able to check file versions on servers and Pcs remotely to see if I can save myself any time.
    I've managed this befo using VBS and just wondered if the same was possible using Power Scripts.
    Can anyone point me in the right direction please - I'm very new to PS also :)
    Kind Regards
    Matthew

    That's looking for a .VersionInfo property on a string. Try this (notice the parentheses):
    (Get-ChildItem '\\10.1.2.3\c$\temp\Test.exe').VersionInfo
    That's going to return its own object, though. Explorer is going to show you four of the properties from that combined. The easiest way to get something is to just use the 'FileVersion' property, but again, that's not always reliable if you're interested
    in build/private versions, and it's not what Explorer shows you.
    If you use the Update-TypeData (or the .ps1xml for v2) from the
    gallery page I mentioned, you could do this:
    (Get-ChildItem '\\10.1.2.3\c$\temp\Test.exe').PSFileVersion
    And that would give you the version Explorer shows you. You can also use comparison operators against other "Version" types.
    You can put the steps required to set that up in your profile, and then that computer will always have that property on file objects.

  • In Internet Explorer, in the internet options, you can change the temporary internet files to check for newer versions of stored pages. Can this be done in Firefox? And How?

    I just want to know how I can change the settings to check for newer versions of stored pages in Firefox.

    There is a hidden preference that controls when Firefox checks for a newer version. # Type '''about:config''' into the location bar and press enter
    # Accept the warning message that appears, you will be taken to a list of preferences
    # Locate the preference '''browser.cache.check_doc_frequency''', double-click on it to change its value
    For details on the possible values of his preference see http://kb.mozillazine.org/Browser.cache.check_doc_frequency

  • Wrong CAP file version error message

    I'm trying to write a loader application that will send a CAP file into JavaCard, and then install it automatically.
    I have developed my JavaCard Applet by using Eclipse3.1.0 and JCOP30.
    After running my JavaCard Applet by Eclipse, I got its CAP file in folder [b\bin\FVSCardPkg\javacard\[/b]
    But when I run my loader application with this CAP file, the error message will display:
    EX: msg Wrong CAP file version, class class com.ibm.jc.JCException
    Wrong CAP file version
         at com.ibm.jc.CapFile.parseHeader(Unknown Source)
         at com.ibm.jc.CapFile.readCapFile(Unknown Source)
         at com.ibm.jc.CapFile.<init>(Unknown Source)
         at LoaderPkg.loader.load(loader.java:35)
         at LoaderPkg.loader.main(loader.java:20)
    This is my loader application source code:
    import java.io.*;
    import com.ibm.jc.*;
    import com.ibm.jc.terminal.*;
    *  Sample /**
    *  Sample loader. Demonstrates how to use the offcard API to download
    *  a cap-file on a JCOP41V22 Engineering sample card and listing of applets loaded will
    * follow.
    public class loader{
         private final static String termName = "pcsc:4"; // Real card
    //     private final static String termName = "Remote"; // Simulator
         protected static final byte[] JCOP_CARD_MANAGER_AID = { (byte) 0xa0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00};
         protected static final byte defaultInstallParam[] = { -55, 0 };
         static String[] capFileName={"D:/MyCardPkg.cap"};
         public static void main(String[] args){
              try{
                   loader l = new loader();
                   l.load();
              }catch(Exception e){
                   System.err.println("EX: msg " + e.getMessage() + ", class " + e.getClass());
                   e.printStackTrace(System.err);
              System.exit(0);
              //Likewise for simulation, be patient the port takes time to close.
              //Use command line "netstate" to check the disapperance of the port before
              // activating JCShell command to read the simulated card.
         private loader(){}
         private void load() throws Exception{
              CapFile capFile = new CapFile(capFileName[0], null);
              System.out.println("Package name: " + capFile.pkg);
              byte[][] applets = capFile.aids;
              if ((applets == null) || (applets.length == 0)){
                   throw new RuntimeException("no applets in cap file");
              // Get connection to terminal, take note that jcop.exe is required to be activated
              // in simulation mode.
              System.out.println("Open terminal ...");
              //Make sure that the simulator jcop.exe is activated before unmarking this satement
              //Remember to delete the downloaded applet before running otherwise error is
              //expected if the simulator finds the existence of the applet with the
              //same pakage name ID and AID
              //Issue /close command at "cm" prompt if the card is in use,, ie it should
              //have "-" prompt. Be patient that the port takes time to close. Use command line
              //"netstate" to check the disapperance of the port before running.
              // pcsc:4=Card Terminal  Or  Remote=LocalHost Terminal
              JCTerminal term = JCTerminal.getInstance(termName, null);
              //For real JCOP41V22 card, please unmark this statement and delete the downloaded
              //applet before running. Error expected if the card finds the existence of the applet
              //with the same pakage name ID and AID
              //Issue /close command at "cm" prompt if the card is in use,, ie it should
              //have "-" prompt.
              term.open();
              // Add in this statement for real card which requires some response time
              term.waitForCard(5000);
              // Create a logging terminal spitting out the APDUs on standard out
              TraceJCTerminal _term = new TraceJCTerminal();
              _term.setLog(new PrintWriter(System.out));
              _term.init(term);
              term = _term;
              // Get JavaCard representative, passing NULL resets card and returns ATR
              System.out.println("Get card ...");
              JCard card = new JCard(term, null, 2000);
              // Get the off-card representative for the card manager and use it to
              // select the on-card CardManager
              System.out.println("Select card manager ...");
              CardManager cardManager = new CardManager(card, CardManager.daid);
              cardManager.select();
              // For downloading something, we have to be authenticated to card manager.
              // For this, the keys must be set. The keys to use should of course
              // be configurable as well.
              byte[] dfltKey = c2b("404142434445464748494a4b4c4d4e4f");
              cardManager.setKey(new OPKey(255, 1, OPKey.DES_ECB, dfltKey));
              cardManager.setKey(new OPKey(255, 2, OPKey.DES_ECB, dfltKey));
              cardManager.setKey(new OPKey(255, 3, OPKey.DES_ECB, dfltKey));
              cardManager.setKey(new OPKey(1, 1, OPKey.DES_ECB, c2b("707172737475767778797a7b7c7d7e7f")));
              cardManager.setKey(new OPKey(1, 2, OPKey.DES_ECB, c2b("606162636465666768696a6b6c6d6e6f")));
              cardManager.setKey(new OPKey(1, 3, OPKey.DES_ECB, c2b("505152535455565758595a5b5c5d5e5f")));
              System.out.println("init Update ...");
              cardManager.initializeUpdate(255,0);
              System.out.println("Authenticate to card manager ...");
              cardManager.externalAuthenticate(OPApplet.APDU_CLR);
              // And load the cap-file, do not forget to call installForLoad
              System.out.println("Loading cap-file ...");
              byte[] cardManagerAid = cardManager.getAID();
              cardManager.installForLoad(capFile.pkgId,0, capFile.pkgId.length, cardManagerAid, 0, cardManagerAid.length, null, 0, null, 0, 0, null, 0);
              cardManager.load(capFile, null, CardManager.LOAD_ALL, null, cardManager.getMaxBlockLen());
              byte[] capaid = capFile.aids[0];
              System.out.println("Finished loading !");
              // Install applet, we try to install the first applet given in the
              // cap file, and try to instantiate it under the same AID as given for its
              // representation in the cap file. No installation data is passed.
              System.out.println("Installing applet ...");
              cardManager.installForInstallAndMakeSelectable(capFile.pkgId, 0, capFile.pkgId.length, capaid,0, capaid.length, capaid, 0, capaid.length, 0, defaultInstallParam, 0, defaultInstallParam.length, null, 0);
              System.out.println("Install succeeded!");
              // synchronize state with on-card card manager
              System.out.println("Update!");
              cardManager.update();
              // Print information regarding card manager, applets and packages on-card
              JCInfo info = JCInfo.INFO;
              System.out.println("\nCardManager AID : " + JCInfo.dataToString(cardManager.getAID()));
              System.out.println("CardManager state : " + info.toString("card.status", (byte) cardManager.getState()) + "\n");
              //Echountered error 6A 86 with this statement:Object[] app = cardManager.getApplets(CardManager.GET_APPLETS,
              //CardManager.CVM_FORMAT_HEX, true);
              //Solved the bug by playing the integers in arg0 and arg1.
              Object[] app = cardManager.getApplets(1, true);
              if (app == null) {
                   System.out.println("No applets installed on-card");
              } else {
                   System.out.println("Applets:");
                   for (int i = 0; i < app.length; i++) {
                        System.out.println(info.toString("applet.status", (byte) ((OPApplet) app).getState()) + " " + JCInfo.dataToString(((OPApplet) app[i]).getAID()));
              // List packages on card
              // Encountered error with this statement:Object[] lf = cardManager.getLoadFiles(CardManager.CVM_FORMAT_HEX, true);
              // Solved the bug by setting arg0 = 0,
              Object[] lf = cardManager.getLoadFiles(true);
              if (lf == null) {
                   System.out.println("No packages installed on-card");
              } else {
                   System.out.println("Packages:");
                   for (int i = 0; i < lf.length; i++) {
                        System.out.println(info.toString("loadfile.status", (byte)((LoadFile) lf[i]).getState()) + " " + JCInfo.dataToString(((LoadFile) lf[i]).getAID()));
              term.close();
         static String numbers = "0123456789abcdef";
         private byte[] c2b(String s) {
              if (s == null) return null;
              if (s.length() % 2 != 0) throw new RuntimeException("invalid length");
              byte[] result = new byte[s.length() / 2];
              for (int i = 0; i < s.length(); i += 2) {
                   int i1 = numbers.indexOf(s.charAt(i));
                   if (i1 == -1) throw new RuntimeException("invalid number");
                   int i2 = numbers.indexOf(s.charAt(i + 1));
                   if (i2 == -1) throw new RuntimeException("invalid number");
                   result[i / 2] = (byte) ((i1 << 4) | i2);
              return result;
    How to solve this problem?
    Thank you in advance.

    I'm not understanding if your cap file is in "b\bin\FVSCardPkg\javacard\", then why are you loading "D:/MyCardPkg.cap"?
    The issue isn't with your off card application, but the cap file version. Look at the cap file components in JCVM specification. I believe it's the Header component. The major, minor should match your card but not greater. In other words, your can't load a 2.2 on a 2.1 card, but a 2.1 can load on a 2.2

  • How can/should I handle file versioning during a TFS Continuous Integration Build?

    Hi all,
    First, I've gone through many docs, links, etc to get a test Build Server up and running along with a successful first Build Definition using both the default and a customized template.  I say this because the question(s) I'm about to ask may have been
    buried in all that information that is now swirling around my head.
    First it might be advantageous to quickly look at what we do now.  In our script we have Major, Minor, Build, and Revision variables that are manipulated both manually and in code.  Let's say we are creating a version 10 of our product.  I
    will go in and edit the Major (10), Minor (0) and Build (0) numbers manually before that versions first script run.  The Revision number is bumped by 1 with each subsequent build.  So, build one of v10 will be 10.0.0.1, then 10.0.0.2, etc.
    This 4 segment version is then used to set the PRODUCT version of the compiled files.
    Later in the build script, we do a dance to get three position version number for our Windows Installer packages since Microsoft only utilizes #.#.# in that realm.  It's basically Build# * 256 + Revision# or something to that effect.  This
    is then passed in to the package.  I guess this part of it could or will need to be handled with an external script and InvokeProcess, which is fine.
    My main concern deals with how versioning works within the confines of a TFS Builds.  I believe I read something about tokens that may be the answer.  What I would like to happen is that all FILE versions are bumped automatically with each build. 
    I don't know if there is a setting that can be utilized within each solution/project that could handle that or not.  Then I'm hoping I can somehow get the Major, Minor, Build and Revision numbers for script use, etc.
    Is there a canned way of going about this or should all of this be scripted in some way with maybe  Pre MSBuild/compile script set up in the Build Definition.
    Any help/guidance with this would be greatly appreciated!
    THANKS IN ADVANCE!!!

    Hi NitLions, 
    Thanks for your post.
    Do you mean that you want to custom assembly file version in each CI build? As far as I know there’s no an standard way of changing the assembly version as part of each build, you can refer to the solution in this article:
    http://tfsbuildextensions.codeplex.com/wikipage?title=Build%20and%20Assembly%20versioning%20%28alternate%20to%20above%20using%20SDC%20Tasks%29.
    Or the information in this article:
    https://tfsversioning.codeplex.com/documentation.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to convert java class file version without decompiling

    Hi,
    Oracle R12.1.3 i am having illegal access error while try to access the class file version Java 1.3 uses major version 47,So how to convert the class file version without using decompiling.
    Current java version is 1.6.0_07
    Is there any tool or API for converting class file version?
    Thanks,
    Selvapandian T

    Beside this I wonder where you get your error from since AFAIK 12c comes with java 1.6.
    Well wonder no more!
    OP isn't using Oracle 12c database.
    They are using Oracle R12.1.3 - which is the E- Business Suite.

Maybe you are looking for