Please don't mock my code, I am just wondering why this does not work for Style Library but it works for the Master Page Gallery
if (siteCollection != null)
{
SPList masterPageLibrary = rootWeb.Lists["Style Library"];
if (masterPageLibrary != null)
{
string featureId = properties.Feature.Definition.Id.ToString();
if (String.IsNullOrEmpty(featureId))
{
throw new ArgumentNullException("featureId");
}
SPFileCollection files = masterPageLibrary.RootFolder.Files;
var checkedOutFiles = from SPFile f
in files
where String.Equals(f.Properties["FeatureId"] as string, featureId, StringComparison.InvariantCultureIgnoreCase)
select f;
foreach (SPFile f in checkedOutFiles)
{
try
{
f.CheckOut();
f.Update();
}
catch { }
//try to check in
try
{
f.CheckIn("Automatically checked in by feature activation", SPCheckinType.MajorCheckIn);
f.Update();
}
catch { }
//try to publish
try
{
f.Item.File.Publish("automatically published by feature activation");
f.Update();
}
catch { }
//try to approve
try
{
f.Item.File.Approve("Automatically approved by feature activation");
f.Update();
}
catch { }
}
}
}
Thanks in advance
Matthew Hughes