Tag Info

Hot answers tagged

23

Absolutely, if you have SPContext.Current, you don't need to dispose any objects inside. The point is, that SPContext.Current is binded to a SPRequest object, which represents current web page request. So basically, if you will dispose SPContext.Current.Web in your code, it will no longer be available for any other pending code. But, if you will create your ...


17

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


16

Backing up with SQL Server is a good scenario if you know what the limitations are. Essentially, this only works fine with normal content databases. Backing up the configuration database is possible, but it's not supported to restore it. In case of a disaster, you'll have to build a new farm. This means that detailed documentation is essential. When you ...


16

The phrase you're looking for is "SharePoint Branding" Perhaps the best place is to start is Heather Solomons blog Other links that may help SharePoint Magazine - Branding Limitations MSDN - Real World Branding with SharePoint 2010 Publishing Sites Codeplex - SharePoint Branding Tool Tom Wilsons SharePoint Branding Blog Randy Drisgill - SharePoint ...


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


10

I'd avoid branching as it will get very difficult to manage when multiple webparts are under different parts of development. Been there - a messy code handed to me and had to figure out better way to maintain. This kind of issues crop up due to "type-based" project structure, where all webparts are under "WebParts" project, all features are under ...


9

When working with SharePoint 2010 and the Visual Studio Tools for SharePoint, you can effectively structure your project how you like - this is because you can use folders to structure things logically, whereas in the past with SP2007 WSPBuilder projects you would typically mirror the 12 hive structure. One option is to use folders for the different ...


9

It depends on what you need to do. RunWithElevated only runs as the Application Pool Identity, so you might not have access to other web applications, only other site collections in the current web application, but you can be guaranteed that you will be running as a user that exists (the AppPool identity). With UserToken, you need to be sure that the user ...


9

So I was intregued as to the actual answer as I have always left it in. I guess one of the reasons why is that I think its good practice and hasn't caused me any problems. This plus Visual Studio puts it in when you override the function. However, it looks like you should leave it in as when reflected this is what's implemented underneath:- public virtual ...


8

Here is a list that I compiled with six different ways (and a few alternatives in the discussions). Six ways to store settings in SharePoint


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

You cannot make cross-sitecollection calls from javascript client object model in SharePoint 2010. But you can make such calls in SharePoint 2013: var crossSiteContext = new SP.ClientContext("http://url-of-another-siteCollection/"); var crossSiteWeb = crossSiteContext.get_web(); crossSiteContext.load(crossSiteWeb); ...


7

Have you considered using Tenants? http://www.harbar.net/articles/sp2010mt1.aspx http://blogs.msdn.com/b/russmax/archive/2010/04/02/sharepoint-2010-multi-tenant-hosting-part-1.aspx http://blogs.msdn.com/b/russmax/archive/2010/04/03/sharepoint-2010-multi-tenant-hosting-part-2-configuring.aspx EDIT: As usual when we are talking SharePoint best practices, ...


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

We can either manually do it through central admin or by using powershell commands. I would prefer doing this through powershell To uninstall and remove Farm solutions use the Uninstall-SPSolution and Remove-SPSolution cmdlets (Use -WebApplication attribute if the solution has webapplication-scoped resources): Uninstall-SPSolution –Identity ...


7

Any kind of hardcoded path is, in general, opposite from best practice so opening a SPWeb or SPList object directly from its full server URL is a no-no. To get the SPWeb object, if you are sure your code will always run in your desired web it is perfectly okay to use SPContext.Current.Web. In all other cases, you might want to look at something like the ...


6

As is often the case when developing with SharePoint, the answer is really "it depends"! If you are configurating webparts, often the best way to configure them are using custom properties and either use UI or .webpart xml file to configure them. If we are talking connection strings for InfoPath, theres data connection libraries Connection strings could ...


6

you could try my free SharePoint MasterPages too http://freespmp.codeplex.com and I have some info on my blog http://engageinsharepoint.co.uk Thanks Matthew Hughes - @mattoo2


6

Matt and Randys' Master Pages make branding from scratch really easy. If you need hep with basic Themes rather than branding (or to save hours of work) use Microsoft's Theme Builder - I wrote a post on what everything relates to here: -> Theme-ing really does help you save some time on the base CSS.


6

You can define another navigation provider that pulls the data from a different source. Typically I use a SharePoint list, but you could use an XML file, database, or whatever makes the most sense for your requirements. The menu control placed on the MasterPage can either have the data source repointed, or you could decide to put a second control on the ...


6

You need to understand SharePoint from an end-user perspective You need to try to implement business solutions using the features provided by the SharePoint platform. Only when you can't should you consider opening Visual Studio and writing custom code. You need to understand that SharePoint development is not like other .NET development. You have to have a ...


6

It depends on how frequently you want search to include recently added content.If the content on any site is updated too frequently (like Sharepoint.StackExchange :-) ) and you want user to search it out, Set high frequency. However, Remember that Crawling happens at the cost of performance. Please check this article as well how to plan crawl : ...


6

I would recommend you to store things like connection strings in secure storages. For example, SPWeb.Properties require only read permission for site, and they can be revealed easily by any advanced user, for example using SharePoint ECMAScript Client Object Model. So if you store user name and password for accessing DB in the connection string, it would be ...


6

AllowUnsafeUpdates=true; is not required to add/delete/update list items unless you are doing these operations in Page_Load or other Get methods. Both CASE 1 and CASE 2 does not look good in terms of best practice. Problems with both case code: Do not use oSPWeb.Lists["MyList"]; instead use oSPWeb.Lists.TryGetList("MyList1"); Do not use list.Items.Add(); ...


5

I'm not remotely biased of course, but I think my Config Store solution is a good option (based on storing config values in a list). In addition to what I list on the codeplex site, there are some later enhancements such as allowing hierarchical config and providing an expression builder for use in ASPX markup, so it has a lot of features which can be ...


5

The perfect site definition is empty. The built-in templates are useless in anything but the simplest solutions. Even if the customer wants exactly what is in the team site template, I still rebuild that as a WSP solution and deply using code. Code is the way to go, because it gives a mix of what the administrators want and what the devs need. the latter ...


5

There was a big discussion in the SharePoint community a while back on site definitions. The conclusion was that things tend to work out better if you use: a minimal site definition Features which are stapled to your minimal site def This gives a more modular implementation of your customizations, though occasionally some things need to be done in the ...


5

The following link describes sharepoint 2010 project structure (VS project structure) http://bitofthought.blogspot.in/2012/05/visual-studio-sharepoint-solution.html



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