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

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
add comment

3 Answers 3

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
add comment

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 http://stackoverflow.com/questions/10411225/sharepoint-2010-mysite-blog-branding-with-publishing-not-working/10438780#comment13758462_10438780 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
add comment
up vote 0 down vote accepted

My Solution

public override void WebProvisioned(SPWebEventProperties properties)
   {
       try
       {
           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
add comment

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.