I'd like to have a feature which adds a script reference to all pages in a site collection when activated.
This seems like a scenario where I should just modify the master page, but for it to affect all pages in the site collection, it will need to modify every master page.
Is it possible to get a list of all master pages so that I can iterate over them and add the script reference?
I have it working with a single master page using:
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPSite site = properties.Feature.Parent as SPSite;
SPWeb web = site.RootWeb;
string url = web.MasterUrl;
SPFile file = web.GetFileOrFolderObject(url) as SPFile;
/*customize file here*/
}
Are there any differences between SharePoint 2010 and 2013 which will require a different solution in one than the other?