none
Master page overriding problem?

    Question

  • I put the following lines in the elements file to put a master page into gallery:

    <Module Name="OSGPageLayouts" Url="_catalogs/masterpage" Path="MasterPages" RootWebOnly="TRUE">
            <File IgnoreIfAlreadyExists = "TRUE" Url="MYEN.master"

    Type="GhostableInLibrary" />
            <File IgnoreIfAlreadyExists = "TRUE" Url="MYFR.master"

    Type="GhostableInLibrary" />
        </Module>

    But when the master page gallery has existing MYEN.master and MYFR.master, I can not override them, i hope that one expert can show me how to override the existing master page by a feature?

    Thanks.
    Sunday, October 26, 2008 5:14 PM

Answers

  •  Mark,

    I'm pretty certain that you're not going to be able to achieve what you're looking for. Once a file has been provisioned you're not going to be able to "reprovision"  or override a file without first removing the old one. The ignorifalreadyexists element just lets the feature not error out if it hits that module and the file exists. This can be usefull if you add a new masterpage to the module section of that feature and decactivate/reactivate the feature to get the additional masterpage provisioned. 

    Now saying that what are you attempting to achieve? If you're just trying to update a masterpage you have a couple options:

    1) If the masterpage was originally provisioned via a feature and you have not customized the masterpage (edited with sharepoint designer) then you can update the original file in the feature and each site that uses that masterpage should get the "update" as uncustomized masterpages use that file as the template.

    2) Create a new feature that provisions a new masterpage and optionally use a feature receiver to programatically set the masterpage for the site your targetting.

    Regards,

    Josh Carlisle
    Monday, October 27, 2008 2:57 AM

All replies

  • Try changing this value of IgnoreIfAlreadyExists to FALSE

    Stu
    Sunday, October 26, 2008 6:27 PM
  • Thanks.

    I try that ,but it seems that it does not work, any other solution to fix this problem?

    My module is as follows:


    <Module Name="OSGMasterPages" Url="_catalogs/masterpage" Path="MasterPages" RootWebOnly="TRUE">
            <File IgnoreIfAlreadyExists = "FALSE"  Url="My.master" Type="GhostableInLibrary" />
         

        </Module>

    Thanks.
    Sunday, October 26, 2008 8:24 PM
  •  Mark,

    I'm pretty certain that you're not going to be able to achieve what you're looking for. Once a file has been provisioned you're not going to be able to "reprovision"  or override a file without first removing the old one. The ignorifalreadyexists element just lets the feature not error out if it hits that module and the file exists. This can be usefull if you add a new masterpage to the module section of that feature and decactivate/reactivate the feature to get the additional masterpage provisioned. 

    Now saying that what are you attempting to achieve? If you're just trying to update a masterpage you have a couple options:

    1) If the masterpage was originally provisioned via a feature and you have not customized the masterpage (edited with sharepoint designer) then you can update the original file in the feature and each site that uses that masterpage should get the "update" as uncustomized masterpages use that file as the template.

    2) Create a new feature that provisions a new masterpage and optionally use a feature receiver to programatically set the masterpage for the site your targetting.

    Regards,

    Josh Carlisle
    Monday, October 27, 2008 2:57 AM
  • Josh is correct. Basically the point is , you cannot modify a file using feature, which has been itself deployed using a previous feature.

    --
    MAdhur

    http://blogs.msdn.com/mahuja | Please mark the replies as answers if they help
    Monday, October 27, 2008 4:37 AM