Upgrade page layout with sharepoint feature - sharepoint

I use sharepoint 2010. I have a feature which contains some pages layout. When the feature is activated, page layout are applied. But when I deploy a new version of this feature with a new version of pages layout, page layout aren't take into considerations because they have the same name.
How can i do this ?

Your page layouts won't update because they're unghosted, i.e. customized in the Master Page Gallery.
It has nothing to do with the files having the same name unless you've explicitly set IgnoreIfAlreadyExists to FALSE in your elements.xml in the feature.
If your solution doesn't contain any important pages yet (development server or otherwise), the simplest solution is the following:
Delete the page layouts, (making sure no pages reference the page layouts in question, else you won't be able to delete them.)
In Central admin, uncheck "Allow Site Collection Administrators to Customize Master Pages and Layout Pages" ( see http://blogs.msdn.com/b/steve_fox/archive/2010/03/08/ghosting-unghosting-in-sharepoint-2010.aspx for details).
Redeploy your solution
See also http://blogs.technet.com/b/wbaer/archive/2007/08/10/ghosts-in-the-machine.aspx for a thorough explanation of ghosting and unghosting in SharePoint
Hope this answers your question.

Related

Custom branding in SharePoint Online

How can I change look and feel of a SharePoint site in SharePoint online. I want to be able to change the master page i.e remove left navigation and change layout and what is there in masterpage.
There are so many articles and samples in the web that provide information on changing the UI of a Sharepoint site,
Below are some- >
https://support.office.com/en-us/article/Video-Change-look-and-feel-baff6052-436d-4065-953f-24612834fff5
https://support.office.com/en-us/article/Change-the-look-of-your-SharePoint-site-06bbadc3-6b04-4a60-9d14-894f6a170818
You can have custom css files and do changes to master pages using the SharePoint designer which can be downloaded using the below link.
https://www.microsoft.com/en-us/download/details.aspx?id=35491
Still its preferred to go with out of the box themes as MS push updates to your sites which may break your customizations, even though there will be a notification in your Admin center it can only be seen by the admins and if the message is not passed it may break your customizations.

SharePoint 2010 v4.master Content Type

I'm taking over a SharePoint portal and noticed the previous developer used SharePoint Designer for all of the development whereas I use Visual Studio custom solutions/features for development.
NOTE: Site Publishing Features are enabled on a Team Site template for some web applications.
The issue I've noticed is the v4.master content type was changed from "Master Page" content type to "Page Layout" content type. This must have been done through the "Edit Properties" on the publishing site. When opening the site in SP Designer, the v4.master shows up in Page Layouts instead of Master Pages.
The v4.master also has the blue icon next to it meaning the page is customized and content is stored in the database which is causing performance issues. SharePoint is so slow that users are very frustrated. Also there are script tags in the masterpage pointing to jquery in the top level scripts directory. Personally, I would of created a delegate control for this instead of customizing the v4.master. NO Copy was made. (I totally dislike SP Designer, this tool gives too much power to inexperienced power users that like to put sharepoint developer on their resumes. I am definitely disabling SP Designer)
So, with all that said, what are the best practices or suggestions if any in fixing this issue?
What issues will this cause for future applications or site collections?
Should I develop and deploy a custom master as a feature then "Reset to Site Definition" on the v4.master?
Why does SharePoint allow users to change the Content Type on a Master Page to "Page Layout"? Why is this even an option, it doesn't even make sense?
All you need to do within the SharePoint Designer is publish the master page in the page layouts folder and approve it in the Master pages and page layouts in site settings. The master page will appear in the master pages section in SharePoint designer.

Sharepoint Foundation master pages on subsites

Using Sharepoint Foundation 2010 I've edited v4.master, added a ref to a new CSS file, saved the changes and they are applied to the home site no problem.
However when I create a subsite it uses the old version of v4.master for some irritating reason. I'm vaguely aware that some of the publishing features from SPS are not included in SPF so lots of the online advice isn't relevent (?)
If there is a way to make new subsites inherit the new V4.master I'd be very grateful.
This is only possible with a custom WSP or an HttpModule, both requiring .NET code. The Server versions of SharePoint handle this easily with the Masterpage option, a quick google search for "foundation masterpage solution" gave good results, including:
http://blog.thedesigndrifter.com/?p=1112
http://rickhilferink.wordpress.com/2011/01/25/creating-a-sharepoint-2010-foundation-masterpage-solution-and-automatically-activate-it-for-all-sites-and-newly-created-subsites/
If you'd like the ability to have a master page at the site collection root inherited by subsites, then you are best off using a publishing site template.
You can then go to: /_Layouts/ChangeSiteMasterPage.aspx and specify your custom master page, and have it inherited by all subsites.
this is probably too late to benefit you, but maybe it will benefit others. I have found that if you do not rename the customized master page to something other than v4.master, then subsites will not inherit the customized version of v4.master but use the original uncustomized v4.master instead. So make sure that you make a copy of v4.master and rename it. Here are some steps from [my blog post], this is how i did it:
Right-click on v4.master and select ‘Reset to site definition’ and the original v4.master will be restored, and SPD 2010 will automatically create a v4_copy(1).master page (screenshot 14).
Check-in custom.master, publish a major version, and approve the file
Go to Site Actions > Site Settings > Master Pages and select the new master page, custom.master, for both Site Master Page and System Master Page, and select the checkbox for ‘Reset all subsites to inherit this alternative CSS URL’ (screenshot 15)
Now if you have forgotten to activate the publishing feature for you new subsite with the Team Site template, it will not inherit the custom.master page yet, so go to Site Actions > Site Settings > Manage site features and activate the publishing feature (screenshot 16)
As soon as the feature is activated you should see the new master page and its styles (screenshot 17)
I solved this problem by creating new a custom site defintion by Visual Studio and SharePoint Site Definition. I added a feature which adds my custom masterpage (edited from
v4.master) into site collection's masterpage gallery (_catalogs/masterpage):
<Module Name="MasterPageModule" RootWebOnly="FALSE" List="116" Url="_catalogs/masterpage" >
<File Url="mymasterpage.master" Path="MasterPageModule\mymasterpage.master" IgnoreIfAlreadyExists="TRUE" Type="GhostableInLibrary">
<Property Name="ContentTypeId" Value="0x010105"/>
</File>
The main thing to get the same masterpage for all sites is to set MasterPageFile -property in Default.aspx like this:
MasterPageFile="~sitecollection/_catalogs/masterpage/mymasterpage.master" - this refers always to rootsitecollection level.
I think that same thing can be achieved by using FeatureActivated-method, but it didn't worked in my case, don't know why.

Moss Sub sites navigation elements

My site structure looks like this:
- top-level site
--sub-site
---page
---page
--sub-site
---page
I want to disable the link on the tab of each sub-site that currently links to default.aspx so that it acts as a heading to the pages only and not a url that can be clicked. When users navigate over the sub-site tab, the pages drop down menu displays.
Would I need to code this?
Coding it would make it easier as it would give you more control over the html. It is not a massive job to create a custom navigation provider and include it in your masterpage/page layouts.
This is a reasonable introduction to your options.
I personally have found the code released here by the SharePoint team to have been very useful.

Page Layout does not appear in the page layouts list

I have a feature that deploys a few site columns, a content type (inheriting from Page Publishing Content Type) and a page layout based on my content type.
Everything is fine on two tests, performed on different servers, but on the third server, although the feature is being activated correctly and I can see the site columns, content types and the page layout in the galleries, I cannot create a new page based on my page layout because the page layout does not appear in the list of available page layouts.
On all tests I have used the administrator account.
Does anybody have any thoughts on possible reasons for this?
Thanks.
Did you have a look at the "Page layouts and site templates" page under Site Settings? On this page you can enable an option that limits the available page layouts to a specified list of page layouts.
I have worked on a project where we needed to limit the page layouts available on a custom site definition. We implemented this in a feature, that enabled the "limited page layouts" option and populated the list of available page layouts upon activation.
If this is the issue you are having you could simply turn off this option in the web interface or add the new page layouts manually, but you could also consider implementing a feature receiver that automatically adds your custom page layouts to the list of available layouts.
Thank you all for your answers.
What actually happened is that the page layout was, for some reason, deployed as a Master page and not as a Page Layout. The admin has manually changed this and now it works.
This is just an educated guess but check to see if the Page Layout is waiting to be checked-in or approved.
In my case the path for the layout was wrong so the layout itself ended up in a different location, when I corrected that i was able to see the results.
I had added files manually and it did not appear.
When I edited properties of that layout page from UI and saved it, it appeared.

Resources