Sharepoint Master Page Implementation - sharepoint

I have a master page already created by a colleague, how can I implement this master page in SharePoint?

There are several ways you can use to change the master page of a SharePoint site. Here are some http://sharepointmagazine.net/articles/deploying-the-master-page , http://office.microsoft.com/en-us/sharepoint-designer-help/change-the-current-master-page-HA010167165.aspx . I hope it helps.

If you want to create and deploy a new master page using Visual Studio 2010, see following steps.
1.Right click SharePoint Project in Visual Studio select Add New Item.
2.Select Module Template and name it as MasterPageModule. Click Add.
3.Rename the Sample.txt to Sample.master
4.Open the Elements.xml, delete existing text and replace with following code
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="MasterPageModule" List="116" Url="_catalogs/masterpage">
<File Path="MasterPageModule\Sample.master" Url="MasterPageModule/Sample.master" Type="GhostableInLibrary" IgnoreIfAlreadyExists="false" />
</Module>
</Elements>
5.Open the existing site with SharePoint Designer.
6.Go to Site Objects -> Master Pages and copy v4.master
7.Rename and select the new file.
8.To edit the file select Customization -> Edit.
9.Select Yes for "Do you want to check it out?" message.
10.Select all code from the copied master page and copy to the Sample.master file.
11.Modify the code (You can also modify the file in SP Designer and then copy)
12.Build and deploy the solution.
13.Go to http:///_catalogs/masterpage/Forms/AllItems.aspx
14.Open the MasterPageModule Folder.
You’ll see the deployed Sample.master page.

Using SharePoint designer, connect to your site and copy the master page file into the Master Page library. Then right click on the master page file in SP Designer and select "Set as Default Master Page".

Related

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.

How to add a new WebPart in a specific Group after it is deployed

I am constantly writing custom WebParts but after I deploy them, they always get added to the "Miscellaneous" category. How do I add a WebPart to a specific category?
The category that I am referring to here is the one we see in the "Add Web Parts..." pop up, which is activated when the "Add a Web Part" is clicked on a zone.
Thanks
You need to update your web part manifest file and add the following:
<property Name="Group" Value="Custom" />
Follow the instructions here for details.

SharePoint Custom Action on Site Settings Page

I have a Custom Action on the Site Settings page of my SharePoint site that appears in the UsersAndPermissions list. It is created using a feature, this is the elements.xml file for the feature:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="SDITeamGroupApplicationPage"
GroupId="UsersAndPermissions"
Location="Microsoft.SharePoint.SiteSettings"
Sequence="1000"
Title="Create a Team Group">
<UrlAction Url="_layouts/SDITeamGroupEdit.aspx"/>
</CustomAction>
</Elements>
Currently all the users of site can see this link on the Site Settings page. I want to be able to restrict who can see this link. Is this possible? How can it be done?
http://msdn.microsoft.com/en-us/library/ms460194.aspx
Look for the elements called "Rights" and or "RequireSiteAdminstrator" etc.
Here are the list of possible "Rights":
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx
You can create a visual studio solution which uses CustomAction for such requirements.
Here is the step by step instructions to build a visual studio solution which adds new custom link in site settings page: Add a Link to Site Settings Page in SharePoint.

Set the Category/group for webpart on deployment using WSPBuilder

I have developed an event handler,called TaskListEventHandler, for the Task list ((ItemAdding, ItemDeleting, ItemUpdating) as feasture using the WSP Builder project template, and I have also added a web part, called RegisterEventHandler, which will be used to bind(register) the events to a list. The webpart is WSP Builder template "Webpart without feature".
Currently, on deployment, my feature and the webpart is getting deployed sucessfully. The web part is also available in the web part gallery.
Now i need to make the web part available in a particular category/group in the gallery using the WSP Builder?
I tried setting the group in the RegisterEventHandler.webpart file (which is automatically created by WSP builder on adding the webpart template inot the project), but still it doesn't show up :(
Cannot import RegisterEventHandler Web Part.
RegisterEventHandler
This webpart is used to register or unregister the event handler to the task list - By Biju (09 Sep 2009)
Biju Webparts
Could anyone please help or suggest me some solution or sample code?
Like Per says.. if you add a webpart feature with wspbuilder it will give you an elements.xml file. This contains an entry like this:
<File Url="WPName.webpart" Type="GhostableInLibrary">
<Property Name="Group" Value="MyGroup" />
<Property Name="QuickAddGroups" Value="QuickGroup" />
</File>
Where the properties determine what group is used in the library. Mind you if this web part is already activated in your site re-activating it again wil often not overwrite the existing registration; you'll have to delete the .webpart file from the web part library first.
The category/group of a web part is specified in the elements.xml file (Groups property).
But as Janis comments it seems a little odd to add a web part to add a EventHandler.
If you just want to add the eventhandler to all tasklists on the site where you activate the feature then you can do the add in elements.xml directly.
If you want to add it to a special task list then you can do it in an FeatureReceiver.
If you want to give the enduser the option of selecting which list to add it to then a the web part might be ok, but an application page would probably be a more "SharePoint" way of doing it, or use SPEvent Handler Manager from codeplex

Feature not installing, don't know why

I have a project that's built on SharePoint Smart Templates.
I don't have a web part, so I deleted the cs file.
Instead all I have is a blank feature.
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
Id="{6447a5a5-c6c7-4aee-b7c5-b7417e30c03f}"
Title="My Content Types"
Description="Contains the Content Types used by My Provided Applications"
Scope="Site"
>
<ElementManifests>
<ElementManifest Location="Manifest.xml"/>
</ElementManifests>
</Feature>
Any idea why this feature won't install?
update
I manually installed the feature using straight copy and stsadm - this worked, so its not the feature code in question, rather the project could be "whacked"
This feature is scoped at site level. Try to see if you have it in Site Settings -> Site Collection Administration -> Site Collection Features.
I just did away with smart templates, obviously I am not smart enough to use them, and have reverted back to normal WSP Builder, and its working great.

Resources