SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm developed a solution for stapling features. in my solution are located two projects, one project contains a module which consist the id features, what I want to attach to the sites collections and id of the feature for a blog site (project with a scope equals farm)

The content of the module:

<FeatureSiteTemplateAssociation Id="98b7ce51-0bf0-4c5a-82c0-e9c9ec10a4c3" TemplateName="SPSMSITEHOST#0" ></FeatureSiteTemplateAssociation>

<FeatureSiteTemplateAssociation Id="98b7ce51-0bf0-4c5a-82c0-e9c9ec10a4c3" TemplateName="SPSPERS#0" ></FeatureSiteTemplateAssociation>

<FeatureSiteTemplateAssociation Id="087e93f1-958f-4ca8-85da-cd5c591b1baa" TemplateName="BLOG#0" ></FeatureSiteTemplateAssociation>

at moment Publishing feature activation for blog, sharepoint throws an exception:

Failed to initialize some site properties for Web at Url:https://mysite/my/person/user1/Blog

Exception occurs when the Publishing feature in a activation process:

web.Features.Add(new Guid("{94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb}")); // publishing feature

Any ideas?

share|improve this question

Since it is on the My Content portion of the My Sites (which is a separate Site Collection for each user), you need to add code to your activation process that first ensures the Publishing Infrastructure is enabled on the Site Collection before trying to add the Publishing feature to the Web.

share|improve this answer
John, I'm already said, that Publishing Infrastructure feature was activated at the time. – Damir Beylkhanov Apr 16 '12 at 17:16

I am also facing the same problem are you able to find a solution if so please help me.I have found the following blog very helpful but there is a small defect in that , which is its showing the blog document library TitleURL wrong

share|improve this answer
you need add event receiver with WebProvisioned type. I'm added answer on my question – Damir Beylkhanov Jun 24 '12 at 7:19
up vote 0 down vote accepted

My Solution

public override void WebProvisioned(SPWebEventProperties properties)
           using (var site = new SPSite(properties.SiteId))
               SPWeb web = properties.Web;
               web.Features.Add(new Guid("{94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb}")); // publishing feature 
               if (!string.IsNullOrEmpty(MySiteMasterPage))
                   web.CustomMasterUrl = site.ServerRelativeUrl + MySiteMasterPage;
                   web.MasterUrl = site.ServerRelativeUrl + MySiteMasterPage;
share|improve this answer

Your Answer


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.