Programmatically get versions for files in sharepoint 2010 document library |
Here is code snippet to get Versions or should say version information for files in Sharepoint 2010 document library. The Code was written in a Console application. This code assumes that you have a document library called “Mydocumentlib” set up with atleast one document and versioning enabled. In the below code the outer foreach loop inspects all the files, while the inner loop retrieves all the versions for each file. using (SPSite site = new SPSite(“http://SharePointSite” foreach (SPFile file in docs.RootFolder.Files) foreach (SPFileVersion v in file.Versions.Cast().Reverse() |
Monday, November 28, 2011
Programmatically get versions for files in sharepoint 2010 document library
Category:
SharePoint 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment