Trying to recurse through a folder and checkout or checkin all files. But i keep getting a DirectoryNotFoundException on the checkin. Oddly enough, i manually uploaded a file to the Agency folder (the root of our recurse) and that file works perfectly. The other folders / files in the Agency folder were put there by a feature and we just want to make sure all files are checked in.
static void Main(string[] args) {
string url = "http://site.sp2013.dev";
using (SPSite site = new SPSite(url)) {
using (SPWeb web = site.OpenWeb()) {
var folder = web.GetFolder("Style Library/Agency");
RecurseFolder(folder);
}
Console.ReadLine();
}
static void RecurseFolder(SPFolder folder) {
Console.WriteLine("+ {0}", folder.Name);
foreach(SPFile file in folder.Files) {
if(file.CheckOutType != SPFile.SPCheckOutType.None) {
file.CheckIn("asdf");
} else {
file.CheckOut();
file.CheckIn("asdf");
}
Console.WriteLine("{0} : {1}", file.Name, file.CheckOutType);
}
foreach(SPFolder subFolder in folder.SubFolders) {
RecurseFolder(subFolder);
}
}
as soon as i hit file.CheckIn("asdf"); i get
An unhandled exception of type 'System.IO.DirectoryNotFoundException' occurred in Microsoft.SharePoint.dll
Additional information: <nativehr>0x80070003</nativehr><nativestack></nativestack>There is no file with URL 'Style Library/Agency/css/ie8-grid-foundation-4.css' in this Web.
Is there something special about files deployed via a feature that will keep them from being updated via the SSOM by chance?