Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

We are looking to change our users' MySite home pages to make them more useful. I can find information on how to update the MySite template used to deploy new MySites, but I need to make the changes to 800 sites that have already been created. I am not having much luck finding details on how to do this.

I am working with Office Sharepoint Server 2007 sp2.

share|improve this question

1 Answer 1

If you need to add/change some webparts you could use something like this:

foreach (SPWebApplication webapp in SPWebService.ContentService.WebApplications) {
    foreach (SPSite site in webapp.Sites) {
        SPWeb web = site.RootWeb;
        if(web.WebTemplate == "yourmysitetemplate") {
            //do something with webparts
            using(SPLimitedWebPartManager manager = web.GetLimitedWebPartManager("default.aspx", PersonalizationScope.Shared)) {
                foreach(AspNetWebpart webpart in manager.WebParts) {
                    using(webpart) {
                        if(webpart is SomeWebPart) {
                            SomeWebPart swp = (SomeWebPart)webpart;
                            swp.SomeProperty = "somevalue";
                            manager.SaveChanges(webpart);
                        }
                    }
                }
            }
        }
    }
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.