Tag Info

Hot answers tagged

21

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


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


15

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


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


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

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


7

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


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

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

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

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

You can do it in InfoPath, cascading drop downs. But since you said you need to do it in jQuery, there is a very useful library, called SPServices, available to assist. Marc has created a function in the library to do cascading drop downs, which is exactly what you want. Look over that information and see if it's helpful.


5

It depends on the "context". In a web part or application page, use SPContext. A lot of example code you see on the web uses a console app for simplicity - these would use the SPSite constructor with a string parameter representing the url. In a Feature receiver you'd use (SPWeb)properties.Feature.Parent. Bottom line is, if the code is being executed ...


5

As per my suggestion, Better to use field's internal name, in future if you may rename your field that doesnot affect the field which you updating on it. because field's internal name never change so no need to update code, whereas display name changed on rename field, so you need to update the code as per you define(renamed) field name


4

Agree with Jaap - caching of objects returned from SharePoint should generally be avoided, since even if that particular object doesn't implement IDisposable (and thus require disposal by you), it's likely that other objects which do will be referenced. In addition to memory pressures mentioned by Jaap I think you could run into other problems. Here's what ...


4

Not sure if it's a good idea to cache native SP objects. Think about memory usage (all that internal COM stuff) and lifecycle management of the objects (when do you dispose your SPSites/SPWebs?) If it's list data you want to cache, why not cache a DataTable? http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitemcollection.getdatatable.aspx ...


4

Or another option is to create a simple html page called App_Offline.htm and put it in the root of the virtual directory. No matter what page is hit, this page gets rendered. When you're done simply delete/nename it. I've only done this before for ASP.NET but it should work for SharePoint as it is build on top off asp.net. Must be .net 2.0 though. Now if ...


4

If all requests go through a proxy server, and your proxy server supports this, create a rule that redirects all traffic for the web application, not just the entire domain, to a new temporary web page. You can also take the low tech route and announce the change to your users by email.


4

We have had an extranet built on SharePoint since 2006 and we made the initial decision to put each client into their own site collection. I know that's a lot of site collections and for us, since we put each site collection in it's on databases, it's a lot of databases. But we feel like that decision was the correct one. It also leaves the most ...


4

Jobs that are already running take priority, and new jobs that want to take over will fail. In order to ensure the new job to run, the old job must finish or be aborted. What does your timer job do exactly? If there are database transactions or file movement, I would say to avoid the abortion of the job if you can help it.


4

I asked a similar question a while ago... but didn't really get much input. I'm sure there is much room for improvement in our current process but it seems to work OK. All webparts use separate Visual Studio Projects Utility classes use separate Visual Studio Projects We use a LOT of Visual Studio Solutions. We've only recently started using Solutions ...


4

Assuming your site collections are in same web application, you can easily use xml sitemap. Below are the steps: 1) Create a xml sitemap(myxml.sitemap for example) at root web application directory. 2)In web.config, under providers section, add : <add name="MySPXmlContentMapProvider" siteMapFile="myxml.sitemap" ...



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