I had to do exactly the same thing at our company. We had many libraries that all needed the content type default to be set to our custom Content Type. I wrote a console application that needed to be run with an account with full privelidges. My code is below for you, I hope it helps.
How my code works, it that all libraries already have the content type I wish to make default added to them. Did that with a different bit of code. This code loops through the site looking for the given content type and makes that number 1 in the ContentTypeOrder. My code also removes the microsoft Document or Page content type as in our environment we didn't need that.
public static void SetDefaultContentTypeOnSite(string siteURL, SPContentType contentType, string listName, bool singleSite)
{
using (SPWeb web = new SPSite(siteURL).OpenWeb())
{
//Find Document Library.
SPList splist = web.Lists.TryGetList(listName);
if (splist != null)
{
if (splist.ContentTypesEnabled)
{
Console.WriteLine(String.Format("Changing Default Content Type on {0} list on site {1} to {2}", listName, web.Title, contentType.Name));
SPFolder rootFolder = splist.RootFolder;
//GetContentType Order.
IList<SPContentType> ctList = rootFolder.ContentTypeOrder;
IList<SPContentType> result = new List<SPContentType>();
//If count is just 1 then it's just Document, so leave it.
if (ctList.Count > 1)
{
foreach (SPContentType ct in ctList)
{
if (ct.Name.Equals("Document"))
{
splist.ContentTypes["Document"].Delete();
splist.Update();
continue;
}
if (ct.Name.Equals("Item"))
{
splist.ContentTypes["Item"].Delete();
splist.Update();
continue;
}
if (ct.Name.Equals("Page"))
{
splist.ContentTypes["Page"].Delete();
splist.Update();
continue;
}
if (ct.Name.Equals(contentType.Name))
result.Insert(0, ct);
else if (ct.Name.Contains("(LtoD)"))
{
continue;
}
else
result.Add(ct);
}
rootFolder.UniqueContentTypeOrder = result;
rootFolder.Update();
}
}
}
if (!singleSite)
{
SPWebCollection collWebsite = web.Webs;
foreach (SPWeb subSite in collWebsite)
{
SetDefaultContentTypeOnSite(subSite.Url, contentType, listName, singleSite);
subSite.Close();
}
}
}
}