Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Programatically - Manage files which have no checked in version - across the farm

$
0
0
Hi

Is the File.Versions.Count validation good enough to force the documents that appear within the "Manage files which have no checked in version" (from Library Settings)? or any more conditions required? assuring that no other files from libraries get any impact out of this action.

private static void ForceCheckInNoVersionedDocuments() {
	try {
using(SPSite site = new SPSite("http://SiteCollection"))
{
SPWebApplication webApp = site.WebApplication;
SPSiteCollection sitesCollection = webApp.Sites;

foreach(SPSite siteColl in sitesCollection)
 {
foreach(SPWeb web in siteColl.AllWebs)
{
if (web.Title.Equals("SP2013"))
{
web.AllowUnsafeUpdates = true;
SPListCollection listCollection = web.Lists;

foreach(SPList list in listCollection)
 {
if (list.Title.Equals("SP2013 Library"))
{
SPListItemCollection items = list.Items;
foreach(SPListItem item in items)
{

if (item.File.Versions.Count.Equals(0))
{item.File.CheckIn("Farm Admin check-in");
}

}
}
 }
web.AllowUnsafeUpdates = false;
}
}
}
}

}
catch (Exception ex)
{
Console.WriteLine(ex.InnerException.ToString());
Console.ReadKey();
	}
finally {
		//
	}
}

Your help and insight appreciated.

Thanks,


Apriori algorithm [association rule]


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>