Feature not installing, don't know why - sharepoint

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.

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 Feature activating for new sites (Stapling ???)

I am developing a sharepoint feature which takes a backup of the site at sitecollection level and at site level whenevar a user tries to delete the site. The feature is working fine without issues for the existing sitecollection and sites when the feature is activated.
To give more picture, i am taking backup through code in events SiteDeleting and WebDeleting events. This events are hooked up using FeatureActivated event. I understand this ensures the event are hooked only up for the existing sites because of my code(i am hooking SiteDeleting and WebDeleting events in FeatureActivated event). After the feature activated, if i create a new site collection/sites the feature is not working(i.e backup is not taken when deleting the site).
I was trying to activate the event for new sites and hence i looked if there will be similar events like sitecreating where i can again hook up the SiteDeleting and WebDeleting events for new sites. But i came to know after some reasearch that there is no sitecreating event which can be used. After bit of googling i found that it can be done through a feature called stapling where we need to create another feature that attaches this feature to the new sites through template name. I have tried installing both the feature(my original and stapling feature) but it never seems to be working...
I am very new to sharepoint development and its taking time for fixing it. It will great if someone can help me to make the feature to work for the new sites as well.. I believe i am doing something wrong in scope parameter of feature.xml..listed below the feature.xml contents.
****SiteDeletFeature (My original Feature)**
Feature.xml
<?xml version="1.0" encoding="utf-8" ?>
<Feature Title="My SharePoint Delete Feature"
Scope ="WebApplication"
ActivateOnDefault="True"
Hidden="false"
Id="DA910034-F270-4932-90D0-05AE2EE13192"
xmlns="http://schemas.microsoft.com/sharepoint/"
ReceiverAssembly="My.Sharepoint.SiteDeleteFeature, Version=1.0.0.0, Culture=neutral, PublicKeyToken=762e98b8afce5f9b"
ReceiverClass="My.Sharepoint.SiteDeleteFeature.DeleteFeatureCallOut">
<ElementManifests>
<ElementManifest Location="Elements.xml"/>
</ElementManifests>
</Feature>
SiteDeleteFeatureStapling
Feature.xml
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
Id="D0495B32-9F78-4142-A456-48B3ECBFFD6C"
ActivateOnDefault="True"
Title="My SharePoint Delete Feature"
Description="My SharePoint Delete Feature"
Version="0.0.0.0"
Scope="Farm">
<ElementManifests>
<ElementManifest Location="FeatureStapling\FeatureStapling.xml" />
</ElementManifests>
</Feature>
FeatureStapling.xml
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<FeatureSiteTemplateAssociation Id="DA910034-F270-4932-90D0-05AE2EE13192" TemplateName="STS#0" />
.
.
.//goes on, i have included all template names
<FeatureSiteTemplateAssociation Id="DA910034-F270-4932-90D0-05AE2EE13192" TemplateName="MyCOMMUNITY" />
</Elements>
I have tried various option in Scope parameter for SiteDeleteFeatureStapling like Web,Site but nothing worked out...
Could some one help me to fix this issue...Thanks in advance!
Regards
Bala
FeatureStapling.xml must have scope = "Farm"
SiteDeletFeature must have scope = "Web"

Is Strong Name necessary in Sharepoint to use a WebPart?

I have created a webpart and want to deploy that in Sharepoint. I want to deploy the web part in bin.
I have not created a strong name for dll (webpart code). Is strong name a must for deploying webpart in bin folder?
I have referred this msdn link to do this.
http://technet.microsoft.com/en-us/library/cc263271.aspx
When I go to WebPart gallery and want to populate a web part, it is not appearing in webpart gallery.
Any help will be appreciated.
Strong name isn't a must for Sharepoint development, but is your easiest option.
You could also to use WSPBuilder (SharePoint WSP tool) to deploy your webparts
I usually strong name my assemblies because I don't want to discover it later on that my assemblies needs a strong name, just in case the assembly is being used in some other way than I originally intended.
I've also had some problems relating to events in Sharepoint where reflection is used to execute functions based on class and assembly info (probably stored in database), so if you add a strong name later on then you have to update the places where the old event was used (e.g. on lists), otherwise your functions won't get hit. On the other hand if you have a strong name then this is easy bu using web.config assembly redirect
I like your idea though of having the assembly in bin, that way you can use CAS which provides more control for administrators.
To resolve this problem then you could start out by adding the strong name and deploying the asembly to the GAC, then add your .webpart (or .dwp) to the web part gallery. If that works you can try moving the assembly to the bin folder and then remove the strong name.
You might consider deploying the webpart in a feature and add the code neccessary to add the .webpart file to the gallery on the fly so you dont have to worry about the file, this can be accomplished by using code using a feature receiver
using (SPWeb web = site.OpenWeb())
{
web.AllowUnsafeUpdates = true;
site.AllowUnsafeUpdates = true;
SPList list = web.Lists["Web Part Gallery"];
SPFolder root = list.RootFolder;
SPFile spFile = root.Files.Add("ContentEditor.dwp", s);
spFile.Update();
}
or by using caml xml
<?xml version="1.0" encoding="utf-8"?>
<Feature Id="8425EAF8-6GBE-4698-83C7-831CA8614D6D"
Title="WebPart"
Description="Some description"
ImageUrl="GenericFeature.gif"
Scope="Site"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="elements.xml" />
</ElementManifests>
</Feature>
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module
Name="WebPart"
List="113"
Url="_catalogs/wp"
RootWebOnly="TRUE">
<File Url="WebPart.dwp" Type="GhostableInLibrary" />
</Module>
</Elements>

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

Resources