11

From your code it would seem that you are trying to set a web-application property from a site collection scoped feature. If you are using SharePoint 2010, I can assume that you are experiencing the effect of the new "RemoteAdministratorAccessDenied" security setting, which among the others by default block any attempt to alter a web app property from a ...


7

As EStruyf said, you can change the deployment configuration and debug the code for your Feature Event Receivers. But, you can also attach the event receivers after making sure List is created, so put this code after your list is created. public class Feature1EventReceiver : SPFeatureReceiver { public override void FeatureActivated(...


7

Your plan is good, and respects good practices (at least the practices I've been following for ages). Your approach is to: Create the solution in VS Create one feature (scope: Web) Create two classes for the event receivers (both inheriting from SPItemEventReceiver) Add a feature event receiver on the feature (inheriting from SPFeatureReceiver) In the ...


4

Short answer: you can't. And why would you create the database using a feature? If you are creating an installer anyway, create the DB there using a db create script or a custom seetup action. As for storing the DB connectionstring and or DB credentials: Use the SecureStore Service Application. See this article for information on how to configure the ...


4

The code compiles and runs fine for me as long as there is a reference to Microsoft.SharePoint (2010). Are you building a console application? In that case make sure you are using the .NET 3.5 framework (not compact or anything else) and set the platform target to Any CPU in the build section of the project properties. BTW. note that you are leaking a site ...


3

You need to use the Update() method on the SPListItem object. Also, you want the line: listitem["Activated Time"] = DateTime.Now.TimeOfDay; to be simply: listitem["Activated Time"] = DateTime.Now; otherwise you'll get an unhandled exception. This is the code I have, which works (the method being the same one you've selected): SPSite site = SPContext....


3

I would recommend to use the first method - Create the Form in SPD, save it in .aspx and include it in a List definition feature. Benefits Creating the form in SPD and doing the modifications required are pretty much easy. For eg.- Adding a list view web part or modifying an XSLT would be quiet easier in SPD. Now, adding .aspx in a list definition in VS ...


3

Try running a check on the parent web to see if the feature is activated. Since this is only applying to sub webs and it is in the FeatureActivated event, it will already be activated on the parent for you to verify. Edit Code added to check if web.ParentWeb != null bool isChild = false; if (web.ParentWeb != null) { foreach (SPFeature parentFeature ...


3

If I remember correctly the flow is: Site Collection Scoped Features Web Scoped Features Lists Modules Your stapled features would be shot in after Site collection scoped features or Web scoped features (depending on scope) and hence the lists is not guaranteed to be created before the lists. Found a source here: http://blogs.msdn.com/b/chrischiaro/...


3

Looks like it is a DLL caching issue. When you start Powershell command line window, it loads all DLLs available in the GAC. So, if you have updated DLL for the feature receiver, and deploying it within the same PS session then it will not reload updated DLL. I had experienced similar behaviour before. To tackle it, I created two seperate PS1 files. First ...


3

Well. It really depends on which feature you have to activate. The id of a feature does not change during its life. This means that if you can find out the id you will be sure it stays the same, regardless of the specific SharePoint farm instance. That said, you can "hardcode" your ID in a support class, much like SharePoint does with fields id in the ...


3

My solution to the problem was to change assembly version from 1.0.0.0 to 1.0.0.1 and build the SharePoint project. After that I deleted feature receiver and added feature receiver again so that feature manifest XML file gets updated with correct version of feature receiver assembly. More details on http://slavensemper.blogspot.hr/2015/08/failed-to-load-...


2

You could use SystemUpdate instead of ProcessBatchData. False should mean modified date doesn't change: SPListItem item = ???; item["myField"] = "my value"; item.SystemUpdate(false); Of course, this means you have to update each item one at a time instead of the batch process which may lead to performance issues. See also, how to temporarily disable email ...


2

I experienced a similar issue. Upon creation of a new site, the features included in the <WebFeatures> node of the ONet.xml were not activated upon site creation. When navigating to '/_layouts/ManageFeatures.aspx' these features would appear to be activated but their code would not run (no files were placed from modules, breakpoints set in event ...


2

It seems that your feature is not web application scoped.


2

Use the -Force option with -globalassemblycache deployment


2

The ReceiverAssembly should be the Fullname of the assembly FeatureBuilder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx If developing using SharePoint templages in Visual Studio 2010 use $SharePoint.Project.AssemblyFullName$


2

I would go for Deepu's explanation in general. For more details rather, you need to consider, assuming you build a WSP package via VS2010: Your own custom list? - if yes, you could do it declaratively in the List Definition (is a bitch to do that XML declaratively for the views - but is doable). Another list? - use Deepu's explanation with the caveat ...


2

The 3rd option is InfoPath - if you're in such a position in which you can enable the SharePoint -> InfoPath integration features. Especially useful if forms will later be maintained by staff who are more familiar with Word or Office as the UI will be very familiar to them.


2

A quick way is to set the value of the active deployment configuration from Default to No Activation (in the properties of the project). That way you need to manually activate your features and you can directly see what goes wrong.


2

I dont think you will need Event Receiver for your purpose, please find this thread of stackexchange SP 2010 Custom Access Denied Pages For help with command you may find this MSDN Article helpful For details steps please go through this Customize the Access Denied Page


2

If your class is: in the same project inherits from SPFeatureReceiver is public has the right [Guid(xxx)] attribute then it should work, but I would consider it a bad practice. A better solution woulc be to have two destinct feature receivers calling common functions, then if at some point you need to differentiate (could be in regards to FeatureUpgrading),...


2

Please check this link to see how to set your home page. If this does not work, please try to debug and check if your FeatureActivated event gets fired. Hope this helps Cheers! My bad that I did not see that. Anyways can you please try below, Please use this in feature activating, SPWeb web = properties.Feature.Parent as SPWeb; if (web != null) ...


2

I'm not sure this will work, but I would try this: public override void FeatureActivated(SPFeatureReceiverProperties properties) { //Get webapplication SPWebApplication webApplication = properties.Feature.Parent as SPWebApplication; //Get current user from any sitecollection and rootweb SPUser user = webApplication.Sites[0].RootWeb....


2

I found the problem: my solution was in Sandboxed mode! Changed the "Sandboxed solution" project's property to False and now it compiles :)


2

You are using the rootweb of the site, not the current web, so any changing you are making is always to the rootweb. Instead of using webTemp to get rootweb, just use webTemp as the web. private const string QuicklaunchHeader = "Saksmappe"; public override void FeatureActivated(SPFeatureReceiverProperties properties) { SPWeb web = properties.Feature....


2

You should be able to use event recievers to do this, more specifically the SPWebEventReciever. From Microsoft: An event receiver is a piece of managed code that responds to SharePoint events when specific triggering actions occur on a SharePoint object. Triggering actions include activities such as adding, updating, deleting, moving, checking in, and ...


2

Often this is due to the SPTimerV4 holding a cached reference to your solution .dll:s try do net stop SPTimerV4 net start SPTimerV4 in PowerShell or cmd when you have retracted your .wsp before reinstalling them


2

You should use Delete() method of SPWeb.Lists SPWeb webSite = properties.Feature.Parent as SPWeb; SPList myCustomList = mySite.Lists["MyCustomList"]; mySite.Lists.Delete(myCustomList.ID); mySite.Update(); You should also create a new SPSite object while running a code as elevated privileges: SPSecurity.RunWithElevatedPrivileges(delegate() {...


2

All Ended up getting things to work After getting SPSite site = properties.Feature.Parent as SPSite; I found out that all I needed to do was add the rest of the url which was could be something like "/NewPage" to the rest of the url since I already had the full site url from the properties. Created a method that passed in the site and the weburl to get my ...


Only top voted, non community-wiki answers of a minimum length are eligible