A Practical Guide to SharePoint 2013

A Practical Guide to SharePoint 2013
A Practical Guide to SharePoint 2013 - Book by Saifullah Shafiq

Saturday, February 4, 2006

How can we retrieve an older version of a document using .NET?

How can we retrieve an older version of a document using .NET?

spFile = EventWeb.GetFile( _FileName );
if (spFile.Versions.Count > 1)
{
 //restore previous version
 spFile.Versions.Restore(spFile.Versions.Count - 1);
}
Similarly, you can delete the document version:
spFile.Versions.Delete(spFile.Versions.Count - 1);