How do i programmatically get the current version of a file?
I asked this same question in the SP2013 forum and I haven't been able to determine the solution. So I posting this here, to maybe get more eyes on this issue.
...I am basically trying to programmatically get the current version of a document in a library, then determine if its a major or minor version, in code. I have tried doing this, to get the current version but I keep getting an empty string returned.
var versions = item.File.Versions;
string currentVersion = string.Empty;
foreach (SPListItemVersion version in item.Versions)
DateTime lastMod = version.Created;
foreach (SPFileVersion fileVersion in versions)
if (fileVersion.IsCurrentVersion == true)
currentVersion = fileVersion.ToString();
Does anyone know what am doing wrong, and how to get this resolved? I really appreciate the help. Thanks
Why not just get the SPListItem and look at it's Version property? That'll be the latest version.
No need to go into the Versions collection etc. When you get a list item you get the current version as standard.
w: http://www.the-north.com/sharepoint | t: @JMcAllisterCH | YouTube: http://www.youtube.com/user/JamieMcAllisterMVP
Similar Messages
-
How do i get the current version of web logic server on obiee 11g
Hey
I am pretty new to 11g and Weblogic
How do i get the current version of web logic server on obiee 11g(11.1.1.5), I know that it should be higher than 10.3.5.
ThanksHi,
Obiee11.1.1.5.0/6.0 both version supporting weblogic 10.3.5.0/6.0 both are no issues.
http://blog.whitehorses.nl/2012/02/26/a-few-quick-tips-for-upgrading-ofm-11g-to-patch-set-5/
also refer
http://docs.oracle.com/cd/E23943_01/bi.1111/e16452/bi_plan.htm#BABECJJH
Thanks
Deva -
How do I programmatically reference the current page in 902?
Hello,
How do I programmatically reference the current page in 902?
The Portal Smart Text option for Current Page is not flexible enough, and I wish to create my own custom greeting using PL/SQL.
Cheers,
Johnhi,
If you are developing a PLSQL Portlet, then you do have a way for getting the page URL.
The page URL can be obtained from the record, portlet_runtime_record. There is a filed page_urlavailable with portlet_runtime_record.
The portlet_runtime_record is passed as a argument to the show_portlet procedure.
--Sriram -
How do I know what the current version of fcpx w/o going to app store?
How do I know what the current version of fcpx without going to the app store? I'm hoping this is obvious and easy but I can't see it yet.
Thanks Neil, and thanks for figuring out that I wanted the general answer, not just the version right now.
But here's the question I should have asked: How do I know when there is a new version of FCPX so I can update right away? Was there an email or alert I missed, or do I just keep checking ? -
Get the current version and level of sp.listitem
I'm using a client script to get sp.listitem from a context.
Everything works and load my item
myCtxtWeb.Load(item);
myCtxtWeb.ExecuteQuery();item.Versions;//doesn't existitem.Level;//doesn't exist
Now i need to know the current version and the previous to compare the modified date between them.
Unfortunately the property doesn't exist and same with property level for having the info if it's approved
Are there a way to have them?For information, i found the solution
SP.File newsItemFile = targetItem.File;
SP.FileVersionCollection fileVersions = newsItemFile.Versions;
myCtxtWeb.Load(fileVersions);
myCtxtWeb.ExecuteQuery();
if (fileVersions.Count > 0)
SP.FileVersion currentVer = fileVersions[fileVersions.Count - 1];//get current version
if (currentVer.VersionLabel == "1.0")
return "add";
Hope it helps some people -
How can I programatically get the TestStand version?
I want to programatically get my Teststand version. Can I get this from inside a LabVIEW VI? I'm writing a VI that produces a Software Description Document and one of the things I want in there is my TestStand version.
You can use the Engine.Version to get a string of the version number. This is useful for a string for display information.
For more detailed information, you can use the following properties:
Engine.MajorVersion
Engine.MinorVersion
Engine.RevisionVersion
Allen P.
NI -
How do I programmatically get the display name for a view object in Java?
When you define a view object, there is a display name that is configured. I would like to retrieve that in Java. Can someone tell me how?
Thanks, -KlausKlaus,
you can use the attribute definitions which you get using
getAttributeDefs
AttributeDef[] getAttributeDefs()This method is accessible via the vo.
If you need this information in a bean, you can use EL like you see if you drop a vo on a page.
Timo -
How can I programmatically get the Bluetooth address of an iPhone
I want to determine the Bluetooth MAC address for an iPhone or iPad from within an app on said device. But I didn't find any API that will return the Bluetooth Address or name .
You can use the VI name to refer to a vi in memory. (note that all VIs in
memory must have a unique name, thus LV can make a reference needing only
the name.)
To refer to a vi not in memory, LV needs a full path. The open VI reference
is polymorphic, it accepts strings and paths (as you already noticed).
"MattI" wrote in message
news:[email protected]..
> This is awesome!
> Looking at the diagram, I am somewhat surprised that Open VI Reference
> works using just the VI names returned by Property
> Node:Application:All VIs In Memory when they are wired to the path
> input to Open VI Reference, but I guess it uses the (relative)
> built-in path info that we users can't see to look up t
he VI which is
> in memory, and then returns the full path. -
I lost m iTunes downloader and cannot get the current version to work even when I download what is SUPPOSED to be the current version of iTunes. What can I do?
If you've tried to install and older version of iTunes then it means exactly what it says, otherwise that message sometimes indicates a corrupt library file...
Empty/corrupt library after upgrade/crash
Hopefully it's not been too long since you last upgraded iTunes, in fact if you get an empty/incomplete library immediately after upgrading then with the following steps you shouldn't lose a thing or need to do any further housekeeping. Note that in iTunes 11 an "empty" library may show your past purchases with links to stream or download them.
In the Previous iTunes Libraries folder should be a number of dated iTunes Library (.itl) files. Take the most recent of these and copy it into the iTunes folder. Rename iTunes Library as iTunes Library (Corrupt) and then rename the restored file as iTunes Library. Start iTunes. Should all be good, bar any recent additions to or deletions from your library.
Alternatively, depending on exactly when and why the library went missing, there may be a more recent .tmp file in the main iTunes folder that can be renamed as iTunes Library.itl to restore the library to a recent state.
See iTunes Folder Watch for a tool to catch up with any changes since the backup file was created.
When you get it all working make a backup!
Should you be in the unfortunate position where you are no longer able to access your original library, or a backup of it, then see Recover your iTunes library from your iPod or iOS device.
tt2 -
How do I get the current ios for ipod
my iPod touch has ios 4.2.1 and it keeps telling me I have the most up to date software. How do I get the current version?
It sounds like you may have a 2nd generation iPod Touch, in which case 4.2.1 is the highest possible iOS. Please check the model number on the back, A1288 is 2nd generation.
Stedman -
Get the current absolute path name?
How to get the current absolute path and file name in javascript?
If using CS3 or CS4
alert($.fileName);
or this should work on all versions.
function WhoAmI() {
var where;
try {var F = FO;
}catch( err ) {where = File(err.fileName);}
return where;
NB: Neither will work if you are using binary scripts! -
I'm trying to update my iphone 3GS to the 4.3.4 version and I am getting the error message "This version of itunes (version 9.1.1) is the current version. How do I update my PHONE and why is an itunes update being confused for my iphone?
You need iTunes 10.0 or greater to update your phone...iTunes isn't confused at all. If you're on a Mac, you'll need OS X 10.5.8 or greater to update iTunes to 10.0 or greater.
-
i get a pop-up window saying the current version of Safari does not support the community toolbar. How do I get rid of this?
You need to uninstall the Community / Conduit toolbar add-on.
Locate the files in bold print and move them to the Trash. The first five are in your root /Library
/Library/Application Support/Conduit
/Library/InputManagers/CTLoader
/Library/ScriptingAddtions (anything CTLoader realted)
/Library/Receipts/<Toolbar name>.pkg
/Library/Application Support/SIMBL/Plugins/CT2285220.bundle
The next one is in your Home folder.
~/Library/Application Support/Conduit
When you're done, try Safari. -
How can I get updates for Photoshop CS5 to download to my new Mac book pro where CS5 is already installed from my original disk? I have tried many times over 2 days. I get the same error messages re downloading error. I successfully downloaded the current version of Adobe DNG Converter & it installed perfectly. Help please!
The Adobe auto updater is highly unreliable.
You need to look for and download the update yourself and then manually apply it as per the detailed instructions on the download page:
Adobe - Photoshop : For Macintosh
~~~~~~~~~~~~~~~~~~~~~~
Please note that the Adobe Camera Raw plug-in must be updated separately, after you have updated Photoshop:
Adobe - Adobe Camera Raw and DNG Converter : For Macintosh -
When i try to update the software for my 3rd Gen iPod Touch to version 5 i get the message 'This version of iTunes (9.2.1) is the current version'. My Mac OS is 10.4.11. How can I update the iPod software?
The later iOSs requires at least OSX 10.5.8 for the Mac. You need iTunes 10.5 but 10.4.11 only goes to 9.x.. 10.5.8 is a paid upgrade.
Are you sure that you have a 3G iPod? If it is 8 or 16 GB it is a 2G and those can only go to 4.2.1 (also requires 10.5.8 or later). A 32 GB can be either 2G or 3G. To identify yours:
Apple - Support - Check Your Service and Support Coverage
Identifying iPod models
Maybe you are looking for
-
How can I import an expdat.dmp for one user into an another ?
Hi Folks ! I have an expdat.dmp for a scheme USER1 (the whole user scheme is exported) I want to import this scheme into Database, but into USER2 and NOT USER1. so at the End of Import I would have 2 schemes that are the same. How could I do it ? MfG
-
When I'm working on my laptop downstairs (or at a local coffeeshop, or when traveling), I'd love to be able to grab files that are on my iMac back home. (without relying on using Dropbox or similar...) Thanks!
-
Need to do multiple calculations from an excel Calendar
I have an excel sheet calendar of 2014, each tab is a seperate month. Under each date I have a series of categories, always in the same order, Reports/Phone Calls/Web Searches/Text/AIM Conversations. On the final tab I'd like to have a calculation b
-
Revision: 3768 Author: [email protected] Date: 2008-10-21 07:48:14 -0700 (Tue, 21 Oct 2008) Log Message: Fix BLZ-262: null pointer exception on redeploy of web app/servlet. I was too agressive in releasing the ThreadLocal variables when the servlet s
-
DbAdapter toplink 'select.... order by...'
I'm using the DbAdapter in BPEL 10.1.2 which uses toplink to load records from a table in a database. Is it possible to add an 'ORDER BY...' clause to control the order in which the records are retrieved?