Hot answers tagged

46

For Features SharePoint Features can be scoped to the Farm, Web Application, Site Collection, and Web Site level depending on the purpose of the feature. The Feature scope is determined by the setting of the Scope attribute in the Feature element defined in the feature.xml file. A sample Feature element tag is given below: <Feature ...


37

If you double-click on the feature (NameofFeature.feature), in your solution. You'll see a properties window come up - as a window that details the title, description, scope, items in solutions, and items in the feature. In the properties window, you'll see an option titled 'Always Force Install'. By default, it is set to False. You can configure that to be ...


35

Welcome to SharePoint Stack Exchange! In your Visual Studio 2012 SP Solution: Enable Always Force Install to True in for your feature. See example below: By default, it is set to False. You can configure that to be set to True.


34

Feature stapling is a tecnique that allows for a feature to be stapled to a site definition by using a support "stapler" feature that defines which features are attacched to which site definition. This allows for a feature to be automatically activated on a site created from a site definition without the need to modify the definition files (onet.xml). This ...


31

I have had this problem, too. The reason why they don't show up in PowerShell is the missing Scope, those feature are orphaned, indeed. We cannot use -Site parameter. What you can is to list it in PowerShell without -Site parameter and filter out those without Scope: Get-SPFeature | ? { $_.Scope -eq $null } This will give you a complete list of orphaned ...


18

There are quite a few things to consider in organizing your structure, or else maintanance or understanding the code becomes a nightmare (even if you revisit after a few years). A similar question was asked in an earlier best practices post. Some rules I follow are: Keep all projects in one folder ("Projects"), keep solutions in another folder ...


14

The best way to do get a quick view of what is being used where in a given content database is with the stsadm command enumallwebs using the addtional parameters supplied with the October 2009 Cumulative Update: stsadm -o enumallwebs -includefeatures -includewebparts -includeeventreceivers -includesetupfiles -includecustomlistview There's also a useful ...


14

One of the problems with content types (there are quite a few!) is that the design with site and list content types works very poorly with the declarative (XML) approach. If you just update your Content Type manifest and re-install the feature new content types will be affected, but not all the list content types already "instantiated" from the site content ...


13

You can't deploy a Web Part at the Scope = Web level. Web Parts must be deployed at the Site level since the .dwp or .webpart file needs to be deployed to the Web Part gallery, which is at the Site Collection level.


12

If you read Vesa Juvonens super-article about SharePoint 2010 WebTemplates, http://blogs.msdn.com/b/vesku/archive/2010/10/14/sharepoint-2010-and-web-templates.aspx, you will see how he organizes and names features and SPI's. It's a very good approach and it mmakes it very easy to locate SPI's and features in the (not so user-friendly when you have tons of ...


11

It's always difficult to properly hide / remove the title field, anyway if it's a content type inheriting from Item (which I bet it is based on its ID inheriting from 0x01) you can safely do the following : Set inherits to FALSE, and rely on the RemoveFieldRef to remove the title field. You won't need to re-enter its definition within the Fields node. Here ...


10

If you want to create a folder, you have to specify its name in the leafName parameter. change your code to : foreach (SPListItem reparto in reparti.Items) { var folder = dl.Items.Add( dl.RootFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder, "Test" ); folder.Update(); } If it can help, here a ...


10

From the point of view of an experienced developer there is no major difference but there are points to consider. Code approach: More friendly for new developers, cause VS environment provides good features for investigating new API You can debug it step by step, comment and use Watch tools, in comparison with XML where you just see the result Before XML ...


10

Elements by Scope helps you understand what elements are allowed for each scope. That also means that solutions can be developed and SharePoint architecture allows them to be deployed at any of the scope documented. Most solutions use FEATURES that are targeted at web or site collection level and when an element is allowed at both web and site level, it ...


10

You can do it via the XML editor as well! Steps: Go to your Features in your project. Open the feature.template.xml file add AlwaysForceInstall="TRUE" to the below tag <Feature xmlns="http://schemas.microsoft.com/sharepoint/" AlwaysForceInstall="TRUE"> Now try to deploy the code.


9

Please visit this blog from Joel Oleson where he describes about SharePoint 15 and Office 15 Wave of Products !!! You can also check out for the Technical Preview Program from Office


9

This might end up as a 'whatever floats your boat' kinda question. I will add though, that whatever you choose, make sure it's consistent throughout the entire solution. Remember that creating Content Types programmatically is done at Feature Activated level, which is after Feature XML is processed, so if you're provisioning Page Layouts, you'll need to ...


9

As far as I know, the only way to upgrade a feature is by calling the Upgrade() method. Any other operation, including deactivation/reactivation, solution upgrade/update etc should in no way force a feature upgrade. I have upgraded some feature after a solution update in the past and they were NOT automatically upgraded by the Update-SpSolution cmdlet (I had ...


9

You're seeing this because RunWithElevated runs the code under the AppPool account of the current web application, but the SPWebApplication itself is stored in the config database, which is handled by a different account (the farm account). You will have to run this Feature at Farm scope in order for it to be able to write to the config database.


8

Project Structure - I'm still experimenting with different styles, though it seems to be the norm to split off artefacts (such as c# WebParts) atomically, and use project references to include a "release version" of that project into a SharePoint Project designed solely for Packaging. This prevents you from building half-finished and broken code and ...


8

Usually this happens if you have feature activated event receiver and use http context in code somehow (accessing to SPContext.Current or creating web part, that might use internally Http context). When you activate your feature through UI, Http context is not null and all may work as expected, but when activating through PS or stsadm Http context is null ...


7

If you're creating a custom list that means you have files like this: feature.xml (to be put inside a subfolder of 12Hive\TEMPLATE\FEATURES) elements.xml (to be put in same folder) schema.xml (to be put in the subfolder of the above defined by Name in ListTemplate) Your manifest.xml will be something like: <?xml version="1.0"?> <Solution ...


7

As the documentation states, when you add new artifacts to a solution you need to reinstall it. Really nothing new here, except for support for solution dependencies (and this is really only half implemented, since you can delete solutions that other solutions depend upon without getting any warning) Feature upgrade is an entirely different matter. No ...


7

The internal name for "Description" is "MasterPageDescription". Try that instead.


7

I think that any .Net guidance that you can find is a really good start, since it's still a .Net project. You could look at the Developing Application for SharePoint 2010 from the Microsoft Patterns & Practices, which is more specific.


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


6

within your solution click on feature.feature and goto its properties, you should now see somthing on the lines of Always Force Install just set that to true and you dont need to do the force attribute anymore! looks like a feature wasnt retracted properly and has become a phantom! ybs has a similar issue here! Visual studio Both site collections ...


6

This error happens if you deploy a solution which contains a visual web part to a different web application on the same farm as the web application where it is already installed. In other words, you have two web applications, A and B on the same SharePoint farm. You want to deploy solution S which contains a visual web part to web application B, but it is ...


6

The _layouts folder isn't a library like the masterpages or webpart galeries. So you shouldn't use a module to provision the files. Just add the files that have to be deployed to the layouts folder to your solution manifest file under the TemplateFiles element: <Solution SolutionId="1242CAD1-692B-4A66-AC93-1565FE7C34E6" ResetWebServer="True" ...



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