2

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?

0

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.

| 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
0

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 https://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

| 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
0

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;
               }}}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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