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"
Related
I'm developing a three level workflow to MOSS 2007, I published it to our test environment with stsadm installfeature and activatefeature and it works perfectly.
I followed this article to publish the new workflow.
After the test session I tried to publish it to the live environment which is the same environment, and the new workflow is visible inside the Site Settings > Site Feature (Status is Active), but won't show inside the Site Settings > Site Collection Workflows.
I don't know what is the problem, because on the test environment everything works fine.
Some informations about the system:
Windows 2003 server
Sharepoint (MOSS 2007 with SP3)
Visual Studio 2008
Thanks for the help!
I report this problem to MS Offical Support and after a few days and some phone calls they solved my problem.
I made a big mistake, I generated a new GUID for the Feature Id attribute, but I forgot to generete new GUID for the Workflow Id and it causes the error, because there were two WF with the same GUID. After I changed it, it started to work well.
<Feature Id="Generate new GUID !!!!"
Title="Default Title"
Description="This feature is a workflow that ..."
Version="12.0.0.0"
Scope="Site"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="workflow.xml" />
</ElementManifests>
<Properties>
<Property Key="GloballyAvailable" Value="true" />
</Properties>
</Feature>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Workflow
Name="My Workflow"
Description="This workflow ..."
Id="Generate new GUID !!!!"
CodeBesideClass="ProjectName.Workflow1"
CodeBesideAssembly="ProjectName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=publicKeyToken"
TaskListContentTypeId="0x000"
AssociationUrl="_layouts/MyAssocForm.aspx"
InstantiationUrl="_layouts/MyInitForm.aspx"
ModificationUrl="_layouts/MyModForm.aspx"
StatusUrl="_layouts/WrkStat.aspx">
<Categories/>
<MetaData>
<Modification_GUID_Name>
Name of Modification
</Modification_GUID_Name>
</MetaData>
</Workflow>
</Elements>
I am trying to figure out how to use a custom Infopath form with a Sharepoint 2010 workflow. I have read about a million tutorials on how to do this, but I always end up receiving a "The workflow template has specified no FormURN for this page." error.
I use a Visual Studio project to deploy the solution. I have a Module containing the .XSN form in a "Forms" folder and of course the Workflow itself.
After tons of googling I think these settings should be correct:
My Form Module def:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="OPF" Url="FormServerTemplates" RootWebOnly="TRUE" xmlns="http://schemas.microsoft.com/sharepoint/">
<File Path="Travel.xsn" Url="Travel.xsn" Type="GhostableInLibrary" />
</Module>
</Elements>
My Workflow def:
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Workflow
Name="Godkjenning av timelister"
Description="My SharePoint Workflow"
Id="d92ce465-4fbd-46ee-9e44-ff0320d2bb75"
TaskListContentTypeId="0x01080100C9C9515DE4E24001905074F980F93160"
CodeBesideClass="OPFWorkflowTest2.Godkjenning_av_timelister.Godkjenning_av_timelister"
InstantiationUrl="_layouts/IniWrkflIP.aspx"
CodeBesideAssembly="$assemblyname$">
<Categories/>
<MetaData>
<AssociationCategories>List</AssociationCategories>
<MetaData>
<Instantiation_FormURN>urn:schemas-microsoft-com:office:infopath:Travel:-myXSD-2005-10-21T21-12-27</Instantiation_FormURN>
</MetaData>
<StatusPageUrl>_layouts/WrkStat.aspx</StatusPageUrl>
</MetaData>
</Workflow>
</Elements>
My Feature def:
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
ReceiverAssembly="Microsoft.Office.Workflow.Feature, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
ReceiverClass="Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver">
<Properties>
<Property Key="GloballyAvailable" Value="true" />
<Property Key="RegisterForms" Value="Forms\*.xsn" />
</Properties>
</Feature>
I have published the form from Infopath as an "Administrator approved form template". After I deploy the Visual Studio Solution the form is displayed in the "Central Administration -> Manage Form Templates" list and is marked as "Workflow Enabled=Yes". I get the No FormURN error no matter how I use the form in the workflow. For instance if I try to use it with a task.
Additional things I have tried:
- Used both Infopath 2007 and 2010
- Security on Infopath form is "Domain"
- The alternate access path is left empty when publishing the form
- Used two completely separate environments
- Endless combinations of different settings in the XML files
It seems like some people have managed to get this to work, but no matter what I do it doesn't work for me.
Here is a link that discuss this problem with various solutions (that doesnt work for me):
http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010programming/thread/fac26787-1729-46c8-9021-80652b3734c8
Can only list 1 link on Stack Overflow... first post. Typical...
So if there is any Sharepoint experts out there, please help me resolve this problem! This is the kind of thing that makes me question the whole product!
I'm able to see the InfoPath form after associating with VS 2010 workflow, please find below article on my blog to verify publishing InfoPath form and let me know if you need any help to resolve above issue.
http://sumansharepoint.blogspot.com/2008/05/points-to-remenber-when-designing.html
these steps are same for both InfoPath 2007 and 2010 forms.
Please find below my feature.xml and elements.xml files
Workflow.xml
Name="MyWorkflow" -->
List
<Task0_FormURN>urn:schemas-microsoft-com:office:infopath:ApprovalForm:-myXSD-2011-01-13T09-41-32</Task0_FormURN>
<StatusPageUrl>_layouts/WrkStat.aspx</StatusPageUrl>
</MetaData>
Feature.xml
I did not see element manifest entry on your feature.xml code, please verify that.
I need to create a web part page to be used in a SharePoint collection site. Any ideas?
Start with this walk-through:
http://msdn.microsoft.com/en-us/library/ee231546(v=VS.100).aspx
A good overview of developing for SharePoint:
http://msdn.microsoft.com/en-us/library/ee231517(v=VS.100).aspx
Update:
My mistake. Have a look at this post, Adding web page to blank sharepoint site definition it is still relevant for SharePoint 2010. The main difference is that visual studio will take care of creating a number of the files for you (feature, etc). Start by adding a SharePoint 2010 module to your SharePoint project. Part of the module will be a Sample.txt file. Delete this file and add the WebPartPage.aspx from the post I mention. Next edit the elements.xml file to reflect an appropriate name for you module. Then ensure this module is included in one of your features and you should have a simple web part page available to you once the feature is activated
I usually copy default.aspx from 12\TEMPLATE\SiteTemplates\sts into a custom Feature. I can then customize the page if I need different Web Part Zone configurations.
Feature.xml:
<?xml version="1.0" encoding="utf-8"?>
<Feature Id="A94D977C-1F3B-4488-9DD5-88E0A03506B0"
Title="My Sample WebPart Page Feature"
Description=""
Scope="Web"
DefaultResourceFile="core"
Hidden="TRUE"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="Modules.xml" />
<ElementFile Location="Files/default.aspx" />
</ElementManifests>
</Feature>
Modules.xml:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="WebPartPage" Url="" Path="Files">
<File Url="MyPage.aspx" Path="default.aspx">
<View List="$Resources:core,lists_Folder;/MyList" BaseViewID="0" WebPartZoneID="Right" WebPartOrder="1"/>
</File>
</Module>
</Elements>
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>
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.