locked
NewsGator Community Site Master Page RRS feed

  • Question

  • Hi,

    I have installed Newsgator 2.5 and I am creating Newsgator Community Site(Private/Public). However while creating site its not taking our custom NGCommunicator.master page as its default master page. I have to set this master page as default when I am creating new Newsgator Community Site in SP2010.

    Only the restriction is I have to do this setting only through Property Bags. Please anyone is having any idea.

    Thanks


    Rajavi

    Monday, March 5, 2012 10:51 AM

Answers

  • Hi Rajavi,

    The above code snippet looks fine as long as the value in the constant contains the absolute url to the master page. Ex: /_catalogs/masterpage/XX.master.

    With reference to your question on site definition, I'm still unable to understand the dependency on site definition. Site definition is one way of re-using an existing site and the other way is by using site template. The approach what I'm suggesting here is to modify the Newsgator base site through browser by applying the new master page, save it as a template (.stp) and then re-use this stp file to create many more sites which will inherit the same properties and the look & feel as that set for the base site. In this approach, you dont even have to play around with the code in order to apply the master page.

    In any case, if the above explanation doesn't hold good in your scenario, below is the explanation for property bags (Though I'm not sure how it is going to help you in this case...). Property bags are just a holder for storing some values related to the SPWeb object. This is stored in a hash table AllProperties. Please refer the below code snippet on how to add a new property.

    SPWeb currentWeb = SPContext.Current.Web;
    currentWeb.AllProperties["masterUrl"] = currentWeb.masterUrl;
    currentWeb.AllProperties["customMasterUrl"] = currentWeb.customMasterUrl;

    Alternately, you may also use currentWeb.AddProperty().

    Please let me know if you require further information.

    Thanks

    • Proposed as answer by Suneetha V Thursday, March 8, 2012 11:30 PM
    • Marked as answer by Jack-Gao Friday, March 16, 2012 10:58 AM
    Tuesday, March 6, 2012 7:56 PM

All replies

  • Hi Rajavi,

    I haven't worked on Newsgator but the problem that I can see is that the master page in the original template is not properly set. Please confirm whether you are doing this:

    1. Installed Newsgator
    2. Modified the basic newsgator site by introducing your custom master page.
    3. Saved the site as a template.
    4. You are creating sites based out of the above template and observe that the new master page is not reflected.

    If above are the steps, I think the problem is with the master page on the basic template.

    Else, please provide more details on the steps.

    Thanks

    Tuesday, March 6, 2012 12:27 AM
  • Hi Suneetha,

    Let me explain the scenario.

    I am applying master page to the newly created Newsgator Community site.

    Please find below code,

    if (currentWebsite.WebTemplate.Contains("NGCOMMUNITY"))
    {
      Uri masterURI = new Uri(currentWebsite.Site.Url + Constants.NGCOMMUNITY_MASTERPAGE);
      currentWebsite.MasterUrl = masterURI.AbsolutePath;
      currentWebsite.CustomMasterUrl = masterURI.AbsolutePath;
      currentWebsite.Update();
    }

    Now the case is,Newsgator no longer going to provide sites based on the  Site Definition.So I can't use WebTemplate property. So I have to do it through Newsgator Property Bag.

    I have no idea how I can achieve this.

    Can please help me.

    Thanks


    Rajavi


    • Edited by RajAcc Tuesday, March 6, 2012 10:34 AM
    Tuesday, March 6, 2012 10:33 AM
  • Hi Rajavi,

    The above code snippet looks fine as long as the value in the constant contains the absolute url to the master page. Ex: /_catalogs/masterpage/XX.master.

    With reference to your question on site definition, I'm still unable to understand the dependency on site definition. Site definition is one way of re-using an existing site and the other way is by using site template. The approach what I'm suggesting here is to modify the Newsgator base site through browser by applying the new master page, save it as a template (.stp) and then re-use this stp file to create many more sites which will inherit the same properties and the look & feel as that set for the base site. In this approach, you dont even have to play around with the code in order to apply the master page.

    In any case, if the above explanation doesn't hold good in your scenario, below is the explanation for property bags (Though I'm not sure how it is going to help you in this case...). Property bags are just a holder for storing some values related to the SPWeb object. This is stored in a hash table AllProperties. Please refer the below code snippet on how to add a new property.

    SPWeb currentWeb = SPContext.Current.Web;
    currentWeb.AllProperties["masterUrl"] = currentWeb.masterUrl;
    currentWeb.AllProperties["customMasterUrl"] = currentWeb.customMasterUrl;

    Alternately, you may also use currentWeb.AddProperty().

    Please let me know if you require further information.

    Thanks

    • Proposed as answer by Suneetha V Thursday, March 8, 2012 11:30 PM
    • Marked as answer by Jack-Gao Friday, March 16, 2012 10:58 AM
    Tuesday, March 6, 2012 7:56 PM