Defines methods that are called when a Feature is installed, uninstalled, activated, deactivated, or upgraded.

learn more… | top users | synonyms

7
votes
4answers
19k views

Error occurred in deployment step 'Activate Features': <nativehr>0x80070002</nativehr><nativestack></nativestack>

I have a feature. On the FeatureActivated event I am creating a list if it is not there. I also have an EventReceiver that in the elements.xml on the Receivers node has the attribute ListUrl. This is ...
7
votes
3answers
4k views

How do you “stop” activating a feature within the feature receiver?

I have a feature receiver with some long running code, hence I use SPLongOperation and delegate for better visual appearance. Basically my feature receiver looks like so: public override void ...
6
votes
3answers
8k views

Best method to create custom NewForm / EditForm

I am new to sharepoint development and need to create some custom NewForm/EditForms for a new custom list I am creating. It seems like I have two choices: ...
5
votes
3answers
6k views

FeatureActivated event receiver giving access denied when trying so set WebApplication property

When a Site event feature is activated I am trying to set some properties on the web application. My feature uses this value. public override void FeatureActivated(SPFeatureReceiverProperties ...
5
votes
2answers
1k views

Can't deploy Admin Approved Form Template using XSNFeatureReceiver in SharePoint 2010

I am trying to deploy an Administrator Approved InfoPath form template to SharePoint 2010 as a feature. I've done this lots of times in 2007 and never had an issue - but this will not play ball. I ...
5
votes
1answer
137 views

How to handle web references becoming stale in a web feature activation

We have a number of web-scoped features all stapled to a site definition, so they are all activated in turn when a web is created from the definition. It seems the feature receivers all share the ...
4
votes
2answers
284 views

Feature Activation Logic (Prevent Activation)

I have three site collection features used to set branding throughout the site collection. I want to prevent the accidental activation of one of the features if one of the three is already activated; ...
4
votes
4answers
1k views

Web Template - Receivers Not Firing

I have a custom web template used to provision site collections that activates features with onet.xml and is deployed as a farm solution. I've tried both feature receivers and event receivers (on ...
3
votes
2answers
6k views

Failed to load reciever assembly

I have issue during deployment. It throws: Failed to load reciever assembly I tried to GAC that assembly, also microsoft.office.sharepoint.clientextensions.dll and Microsoft.Office.Server.dll ...
3
votes
2answers
333 views

updating CustomMasterUrl of rootweb and subweb

I've created a web template and as part of the provisioning process I set the SPWeb.CustomMasterUrl. I do this in code. When I create a site collection using this template it works fine but if I try ...
3
votes
1answer
3k views

Programmatically set homepage in Sharepoint Foundation

I need to set the homepage to default.aspx in my FeatureActivated event receiver. I tried rootWeb.RootFolder.WelcomePage = "default.aspx"; rootWeb.RootFolder.Update(); but that doesn't seem to be ...
3
votes
1answer
563 views

Is SPFeatureCollection.Add method asynchronous?

I have a quite complex application that is split into several features. In order to hide this complexity, I set the IsHidden property of the feature to true, then have created a "master" feature. ...
3
votes
2answers
338 views

Error on feature activated property creation

Im trying to create custom properties on feature activated event, but it doenst work, does anyone has any suggestion, what the problem could be? When i do a console application and try there my code ...
2
votes
2answers
339 views

Difference between enabling feature from PowerShell and activating it via site collection features page?

I am trying to create a SharePoint list based on a list template via a feature. The code for creating the list is in the FeatureActivated event handler of the feature's EventReceiver.cs file. The list ...
2
votes
2answers
147 views

How to catch the feature activate time

I am trying to write one program such that, when ever a feature is activated then it should display the activated time in the sharepoint list. for that i written following code. public class ...
2
votes
4answers
4k views

SP2010 Reset all subsites to inherit masterpage using c#

I'm creating a site feature reciever which sets a custom master page on the root web. I would also like the master page set on the root to be inherit to all the subsites. What is the most elegant way ...
2
votes
2answers
440 views

Unable to Delete Custom Master Page Programmatically During Feature Deactivation 2013

I currently have a custom master page that is being deployed at the Site scope. Once deployed and the feature is activated it makes the master page available for use. I am able to activate the ...
2
votes
3answers
1k views

SPWebConfigModification class will not update Central Admin application's web.config file

Using SharePoint 2010 I am trying to use the SPWebConfigModification class to make some basic changes to web.config files on applications in the farm, including the Central Administration web.config ...
2
votes
1answer
199 views

Will feature receiver get activate if user has no permissions to a site?

Here's what I need...User does not have access to a site (http://myserver/sites/MySite). When user tries to access they are redirected to ugly AccessDenied.aspx. I was researching and found that ...
2
votes
2answers
832 views

Preventing alerts from being sent when programmatically updating list item

I have a feature receiver which batch updates a particular field / column in my list. Code is provided below. NB: This is very simple list item batch processing code which I got from ...
2
votes
2answers
678 views

Why do I get a security validation invalid error updating a field from a feature receiver?

Trying to change the title field of a document library to be required..doesn't want to work. SPList docLib = web.Lists["Process Aids"]; SPField field = docLib.Fields["Title"]; field.Title = "Display ...
2
votes
2answers
519 views

Error occurred in deployment step 'Activate Features': Object reference not set to an instance of an object: feature receiver error

I cretaed a Visual web part in SP 2013. It needs a SharePoint list. So wrote below code in web part feature receiver. When I deploy the solution I get error says Error occurred in deployment step ...
2
votes
1answer
71 views

Programmatically setting HtmlDesignAssociated value

I'm deploying a composed look from the server (including the .spcolor, .spfont, master.html and master.preview files), but I cannot get the field Associated File to select. I've tried setting it in ...
2
votes
1answer
138 views

Add Publishing Pages to specfic subsites programmatically in FeatureReceiver

Currently, I have created subsites programmatically in FeatureReceiver method and have a way to create publishing pages, but they are being created on the root site. Is there a way to target a ...
2
votes
1answer
56 views

Deleting lists upon feature deactivation

I have a FeatureReceiver class for a feature that deploy a couple of list instances. In the FeatureDeactivating event I want to remove those instances as well as other artifacts which get deployed ...
2
votes
1answer
83 views

Deleted Feature Receiver is Still Running

Here is a complicated one I have been banging my head against for months. I have a SharePoint 2010 site feature with a custom navigation provider. I have created a feature receiver that will add the ...
2
votes
1answer
323 views

SPListCollection.EnsureSitePagesLibrary() throwing SPException (specified title already exists in this Web site)

I am attempting to call SPListCollection.EnsureSitePagesLibrary() upon FeatureActivated. The method is throwing the following exception: Microsoft.SharePoint.SPException: A list, survey, ...
2
votes
1answer
335 views

Perform a blob cache flush in a feature event receiver

I have a site collection scoped feature that should provision a css file to the "Style Library" of a site collection. The feature also performs cleanup of the file in the deactivation receiver. I ...
2
votes
1answer
1k views

Event Receivers not added when installing wsp

I have a set of event receivers for a SharePoint 2010 content type and Library. Previously, these would install and automatically be activated when I ran a script to install the wsp solution. I dug ...
2
votes
1answer
1k views

failed to create receiver object from assembly

I have created two features and I want both use same receiver class so I created a class MyFeatureReceiver (somewhere in project SP/MyRecievers/) which implements SPFeatureReceiver and has an ...
2
votes
1answer
396 views

Deploying webparts to default.aspx with a SiteDefinition feature dependency

I tried deploying a Site Definition with a custom default.aspx page. Within the <WebFeatures> node of the Site Definition's Onet.xml I tried to reference a Feature which would get a web part ...
1
vote
1answer
157 views

How to rename a file in the 14 hive - edited-

I need to rename the user.aspx file in the 14 hive layouts directory in a feature event receiver. Is this possible ...if so...how? OK - Bad idea....This is what i want to do: I have a custom ...
1
vote
2answers
3k views

The breakpoint will not currently be hit - debuging feature receiver

I need to debug my feature receiver, so I set up few breakpoints, but when I hit F5 in VS2010, they are all missed, and it says that "The breakpoint will not currently be hit. No symbols have been ...
1
vote
2answers
346 views

Visual Studio 2010 Workflows not associating with list

Probably a silly question: I have a vs2010 project with workflows in a site scoped feature. When i deploy through visual studio the workflows are associated with lists. However when i deploy ...
1
vote
1answer
2k views

Delete page from the Site Pages library

Wondering if someone has the code to delete a page from the Site Pages library in a Feature Event Receiver on de-activation TIA
1
vote
2answers
131 views

Backup a file while custom feature activated?

We have a custom application page "custom.aspx" on the Layout folder, would like to rename the original file "custom.aspx" to "custom_bak.aspx" before the updated/modified custom application page ...
1
vote
1answer
27 views

is It safe to use feature activated method to create new site column which is used then by content type

We have a content type vs project. The content type is adding a field ref. This field ref is a new site column created using same project but as an empty element. This works. I am wondering whether ...
1
vote
2answers
95 views

How to retract unretractable solution

Looks like I made a pretty big mistake when doing some testing with a sample sharepoint project. Ironically, I was trying to spike up a unit testable solution, without writing many of the tests first. ...
1
vote
2answers
140 views

SPWebConfigModification class not found?

Using Sharepoint 2010, I am trying to use the SPWebConfigModification class to add connection strings the the sharepoint's web.config. My problem is that the class SPWebConfigModification is not ...
1
vote
1answer
562 views

Get current user in SPFeatureReceiver?

I am working on a web application-scoped feature which creates a site collection. I would like to set the person who activated the feature as site collection owner. To do that, I would have to either: ...
1
vote
1answer
61 views

Feature stapling always returns item does not exist: it may have been deleted by another user

I'm attempting to create a feature stapled solution that pushes out custom branding to every new site collection created. The following code is in my event receiver: public override void ...
1
vote
1answer
76 views

FeatureActivated() not binding two SPEventReceiverDefinitions

I have a feature which I have placed in the onet.xml in to make it active whenever the site collection is created. The feature contains two event receiver definitions for permission groups. One is for ...
1
vote
1answer
194 views

Add an <assembly> to web.config with SPWebConfigModification

I am trying to add an assembly to configuration/system.web/compilation/assemblies - but with the following code it I get Expression must evaluate to a node-set. private SPWebConfigModification ...
1
vote
1answer
562 views

Feature Activated Event not triggered when creating a new sub site with web template

When I create a new site I have a Web Scoped FeatureActivated event that I would like to run. The feature does get Activated but the FeatureActivated event is not triggered. The site is created with ...
1
vote
4answers
2k views

Error while activating custom feature

I have a wsp package installed as farm solution. package has event reciever on activating feature. When I go to Site Collection Features and activate this feature i get an error Error File ...
1
vote
2answers
127 views

SPDispose check gives error

SPDispose gives error Disposable type not disposed Microsoft.SharePoint.SPSite ***This may be a false positive depending on how the type was created or if it is disposed outside the current scope ...
1
vote
2answers
1k views

how to remove a published content type from subscribed site collections

I have a small Visual Studio 2010 project with one farm level feature that I deploy to a site collection which is configured as my content type hub. The FeatureActivated event adds a site column and ...
1
vote
1answer
516 views

ContenTypes on List Definition not added

I've an ListDefinition with some references to existing Content Types (provided by CTH) but when the list is created the content types are not added. elements.xml <Elements ...
1
vote
1answer
391 views

How Do I Rename a List Instance's Field's StaticName in FeatureUpdating?

I am creating a custom WSP in Visual Studio. This solution has several custom content types with custom fields as well as a list instance with content types enabled. Unfortunately, i need to change ...
1
vote
1answer
762 views

removing a sharepoint solution duplicates entry in web.config?

My intentions is to be able to add and remove web.config changes when a solution is installed or uninstalled. The code below and the powershell below works ALMOST as expected. When I add sp ...