SharePoint Custom Action on Site Settings Page - sharepoint

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.

Related

Is it possible to use a Custom Action to add an item to a Site Actions menu in a Sharepoint 2013 app?

I've been trying for a while to add a Site Action menu element that would link to my remote app web page, like this example.
The problem is that the example is not actually using the custom action to modify a site action menu. This would be easy if I wasn't developping on a Sharepoint app model. When I try to add the custom action to my sharepoint site, nothings happens. I've tried many different variations, all with the same result. Here's what I've settled on, thinking it should work:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Location ="Microsoft.SharePoint.StandardMenu"
GroupId ="SiteActions"
Id="CreateSiteAction"
Title="Create Site"
Sequence="1000">
<UrlAction Url="~remoteAppUrl/../MyRemoteWebApp?" />
</CustomAction>
</Elements>
I can see 2 possible scenarios:
1) My custom action definition is broken or is missing something I don't know about
2) Custom actions on site action menus simply aren't possible for sharepoint apps through XML. This blog seems to suggest this is the case
I mention the XML part because I have actually managed to add an element to the site action menu programatically. The problem is that, as far as I know, I lose the flexibility of the remoteAppUrl token being automatically replaced, along with other annoyances.
So, what are your thoughts on the matter ? Did I miss something ? Can it be done with a purely XML-based definition ? What alternatives are there ?
Turns out it's apparently not really possible, according to this MSDN post. As I mentioned, it IS possible to have the same effect through a code based alternative, but it has its pains.

Sharepoint Master Page Implementation

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".

Custom Ribbon Button doesn't show on subsites

I've successfully added a custom ribbon button to my site and everything shows up as expected. However, when I go to a sub site, my custom ribbon button doesn't show up. How can I get my button to show up in the main site and also sub sites? I assumed that a button deployed to the main site would also carry over to sub sites but I guess that isn't the case. Anyone have any ideas or guidance? My button get's added to the "Media" group of the "Insert" tab for the RTE.
Oh, and I am deploying this with a "Site" scoped feature.
Here is my button code:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="CommandUI.Ribbon.EditingTools.MyCompany_InsertVideoButton"
Location="CommandUI.Ribbon">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.EditingTools.CPInsert.Media.Controls._children">
<Button
Id="Ribbon.EditingTools.CPInsert.Media.Controls.MyCompany_InsertVideoButton"
ToolTipTitle="Video"
ToolTipDescription="Insert a video into the page."
Sequence="50"
LabelText="Insert Video"
Image16by16="/_layouts/MyCompany/images/icons/ribbonInsertVideoButton_16.png"
Image32by32="/_layouts/MyCompany/images/icons/ribbonInsertVideoButton_32.png"
Command="MyCompany_InsertVideoButtonCommand"
TemplateAlias="o1" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="MyCompany_InsertVideoButtonCommand"
CommandAction="javascript:alert('MyCompanyInsertVideoButton clicked!');"
/>
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
</Elements>
Oh, and I am deploying this with a "Site" scoped feature.
I believe this is your problem. You are getting the activation on the current site, but because it is deployed with Site scope, the feature will need to be explicitly activated for every site and subsite you want to use it with.
If you want it to automatically apply to all sites/subsites within a particular web application, deploy your solution with a WebApplication scoped feature. To activate it once deployed, go to Central Administration > Application Management > Manage Web Applications, then choose "Manage Features" in the Web Applications ribbon.
Just a thought. There might be an issue, if you are deploying the ribbon button feature as a farm solution. Can you try the same as a sandbox solution deployment? That might work.

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.

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