Custom Ribbon Button doesn't show on subsites - sharepoint

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.

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

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.

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